#269 Use a json file instead of an ini file to configure hosting.

This commit is contained in:
Chris R 2015-09-08 09:50:47 -07:00
parent 5fb45b3cfb
commit 1b790467a1
2 changed files with 4 additions and 4 deletions

View File

@ -10,7 +10,7 @@ namespace Microsoft.AspNet.Hosting
{
public class Program
{
private const string HostingIniFile = "Microsoft.AspNet.Hosting.ini";
private const string HostingJsonFile = "Microsoft.AspNet.Hosting.json";
private const string ConfigFileKey = "config";
private readonly IServiceProvider _serviceProvider;
@ -25,11 +25,11 @@ namespace Microsoft.AspNet.Hosting
// Allow the location of the ini file to be specified via a --config command line arg
var tempBuilder = new ConfigurationBuilder().AddCommandLine(args);
var tempConfig = tempBuilder.Build();
var configFilePath = tempConfig[ConfigFileKey] ?? HostingIniFile;
var configFilePath = tempConfig[ConfigFileKey] ?? HostingJsonFile;
var appBasePath = _serviceProvider.GetRequiredService<IApplicationEnvironment>().ApplicationBasePath;
var builder = new ConfigurationBuilder(appBasePath);
builder.AddIniFile(configFilePath, optional: true);
builder.AddJsonFile(configFilePath, optional: true);
builder.AddEnvironmentVariables();
builder.AddCommandLine(args);
var config = builder.Build();

View File

@ -15,7 +15,7 @@
"Microsoft.Framework.Configuration": "1.0.0-*",
"Microsoft.Framework.Configuration.CommandLine": "1.0.0-*",
"Microsoft.Framework.Configuration.EnvironmentVariables": "1.0.0-*",
"Microsoft.Framework.Configuration.Ini": "1.0.0-*",
"Microsoft.Framework.Configuration.Json": "1.0.0-*",
"Microsoft.Framework.DependencyInjection": "1.0.0-*",
"Microsoft.Framework.Logging": "1.0.0-*",
"Microsoft.Dnx.Runtime.Abstractions": "1.0.0-*",