Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Commit

Permalink
#269 Use a json file instead of an ini file to configure hosting.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tratcher committed Sep 8, 2015
1 parent 5fb45b3 commit 1b79046
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Microsoft.AspNet.Hosting/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -25,11 +25,11 @@ public void Main(string[] args)
// 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();
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.AspNet.Hosting/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -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-*",
Expand Down

2 comments on commit 1b79046

@tuespetre
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be a surprise for more than a few people ;)

@oryol
Copy link

@oryol oryol commented on 1b79046 Sep 11, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Allow the location of the ini file to be specified via a --config command line arg
You have outdated comment in the code :)

Please sign in to comment.