Using optional configuration for IIS deployment

This commit is contained in:
Praburaj 2015-03-30 11:54:10 -07:00
parent a3b1954810
commit 2f36a9cd6b
1 changed files with 2 additions and 8 deletions

View File

@ -1,5 +1,4 @@
using System;
using System.IO;
using Microsoft.AspNet.Authentication.Facebook;
using Microsoft.AspNet.Authentication.Google;
using Microsoft.AspNet.Authentication.MicrosoftAccount;
@ -32,13 +31,8 @@ namespace MusicStore
//then the later source will win. By this way a Local config can be overridden by a different setting while deployed remotely.
Configuration = new Configuration()
.AddJsonFile("config.json")
.AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values.
// Used to override some configuration parameters that cannot be overridden by environment.
if (File.Exists(Path.Combine(appEnvironment.ApplicationBasePath, "configoverride.json")))
{
((Configuration)Configuration).AddJsonFile("configoverride.json");
}
.AddEnvironmentVariables() //All environment variables in the process's context flow in as configuration values.
.AddJsonFile("configoverride.json", optional: true); // Used to override some configuration parameters that cannot be overridden by environment.
}
public IConfiguration Configuration { get; private set; }