Reacting to Configuration changes
This commit is contained in:
parent
c4097f8080
commit
a3f24bcb1d
|
|
@ -81,9 +81,10 @@ namespace MusicStore.Models
|
|||
{
|
||||
var appEnv = serviceProvider.GetService<IApplicationEnvironment>();
|
||||
|
||||
var builder = new ConfigurationBuilder(appEnv.ApplicationBasePath)
|
||||
.AddJsonFile("config.json")
|
||||
.AddEnvironmentVariables();
|
||||
var builder = new ConfigurationBuilder()
|
||||
.SetBasePath(appEnv.ApplicationBasePath)
|
||||
.AddJsonFile("config.json")
|
||||
.AddEnvironmentVariables();
|
||||
var configuration = builder.Build();
|
||||
|
||||
//const string adminRole = "Administrator";
|
||||
|
|
|
|||
|
|
@ -24,10 +24,11 @@ namespace MusicStore
|
|||
// Below code demonstrates usage of multiple configuration sources. For instance a setting say 'setting1'
|
||||
// is found in both the registered sources, then the later source will win. By this way a Local config
|
||||
// can be overridden by a different setting while deployed remotely.
|
||||
var builder = new ConfigurationBuilder(applicationEnvironment.ApplicationBasePath)
|
||||
.AddJsonFile("config.json")
|
||||
//All environment variables in the process's context flow in as configuration values.
|
||||
.AddEnvironmentVariables();
|
||||
var builder = new ConfigurationBuilder()
|
||||
.SetBasePath(applicationEnvironment.ApplicationBasePath)
|
||||
.AddJsonFile("config.json")
|
||||
//All environment variables in the process's context flow in as configuration values.
|
||||
.AddEnvironmentVariables();
|
||||
|
||||
Configuration = builder.Build();
|
||||
_platform = new Platform(runtimeEnvironment);
|
||||
|
|
|
|||
|
|
@ -41,10 +41,11 @@ namespace MusicStore
|
|||
// Below code demonstrates usage of multiple configuration sources. For instance a setting say 'setting1'
|
||||
// is found in both the registered sources, then the later source will win. By this way a Local config
|
||||
// can be overridden by a different setting while deployed remotely.
|
||||
var builder = new ConfigurationBuilder(applicationEnvironment.ApplicationBasePath)
|
||||
.AddJsonFile("config.json")
|
||||
//All environment variables in the process's context flow in as configuration values.
|
||||
.AddEnvironmentVariables();
|
||||
var builder = new ConfigurationBuilder()
|
||||
.SetBasePath(applicationEnvironment.ApplicationBasePath)
|
||||
.AddJsonFile("config.json")
|
||||
//All environment variables in the process's context flow in as configuration values.
|
||||
.AddEnvironmentVariables();
|
||||
Configuration = builder.Build();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,10 +39,11 @@ namespace MusicStore
|
|||
// Below code demonstrates usage of multiple configuration sources. For instance a setting say 'setting1'
|
||||
// is found in both the registered sources, then the later source will win. By this way a Local config can
|
||||
// be overridden by a different setting while deployed remotely.
|
||||
var builder = new ConfigurationBuilder(env.ApplicationBasePath)
|
||||
.AddJsonFile("config.json")
|
||||
//All environment variables in the process's context flow in as configuration values.
|
||||
.AddEnvironmentVariables();
|
||||
var builder = new ConfigurationBuilder()
|
||||
.SetBasePath(env.ApplicationBasePath)
|
||||
.AddJsonFile("config.json")
|
||||
//All environment variables in the process's context flow in as configuration values.
|
||||
.AddEnvironmentVariables();
|
||||
|
||||
Configuration = builder.Build();
|
||||
_platform = new Platform(runtimeEnvironment);
|
||||
|
|
|
|||
|
|
@ -27,9 +27,10 @@ namespace MusicStore
|
|||
{
|
||||
//Below code demonstrates usage of multiple configuration sources. For instance a setting say 'setting1' is found in both the registered sources,
|
||||
//then the later source will win. By this way a Local config can be overridden by a different setting while deployed remotely.
|
||||
var builder = new ConfigurationBuilder(env.ApplicationBasePath)
|
||||
.AddJsonFile("config.json")
|
||||
.AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values.
|
||||
var builder = new ConfigurationBuilder()
|
||||
.SetBasePath(env.ApplicationBasePath)
|
||||
.AddJsonFile("config.json")
|
||||
.AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values.
|
||||
|
||||
Configuration = builder.Build();
|
||||
_runtimeEnvironment = runtimeEnvironment;
|
||||
|
|
|
|||
|
|
@ -31,10 +31,11 @@ namespace MusicStore
|
|||
{
|
||||
//Below code demonstrates usage of multiple configuration sources. For instance a setting say 'setting1' is found in both the registered sources,
|
||||
//then the later source will win. By this way a Local config can be overridden by a different setting while deployed remotely.
|
||||
var builder = new ConfigurationBuilder(appEnvironment.ApplicationBasePath)
|
||||
.AddJsonFile("config.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.
|
||||
var builder = new ConfigurationBuilder()
|
||||
.SetBasePath(appEnvironment.ApplicationBasePath)
|
||||
.AddJsonFile("config.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.
|
||||
|
||||
Configuration = builder.Build();
|
||||
_runtimeEnvironment = runtimeEnvironment;
|
||||
|
|
|
|||
Loading…
Reference in New Issue