From a3f24bcb1de890508e4d867b5114f3c048869fcf Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 25 Sep 2015 07:51:25 -0700 Subject: [PATCH] Reacting to Configuration changes --- src/MusicStore/Models/SampleData.cs | 7 ++++--- src/MusicStore/Startup.cs | 9 +++++---- src/MusicStore/StartupNtlmAuthentication.cs | 9 +++++---- src/MusicStore/StartupOpenIdConnect.cs | 9 +++++---- .../compiler/shared/Mocks/StartupOpenIdConnectTesting.cs | 7 ++++--- .../compiler/shared/Mocks/StartupSocialTesting.cs | 9 +++++---- 6 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/MusicStore/Models/SampleData.cs b/src/MusicStore/Models/SampleData.cs index f1799c8577..5381bafe19 100644 --- a/src/MusicStore/Models/SampleData.cs +++ b/src/MusicStore/Models/SampleData.cs @@ -81,9 +81,10 @@ namespace MusicStore.Models { var appEnv = serviceProvider.GetService(); - 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"; diff --git a/src/MusicStore/Startup.cs b/src/MusicStore/Startup.cs index 64df6d62c0..fdd1433944 100644 --- a/src/MusicStore/Startup.cs +++ b/src/MusicStore/Startup.cs @@ -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); diff --git a/src/MusicStore/StartupNtlmAuthentication.cs b/src/MusicStore/StartupNtlmAuthentication.cs index fa7a088428..00ec32f5d3 100644 --- a/src/MusicStore/StartupNtlmAuthentication.cs +++ b/src/MusicStore/StartupNtlmAuthentication.cs @@ -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(); } diff --git a/src/MusicStore/StartupOpenIdConnect.cs b/src/MusicStore/StartupOpenIdConnect.cs index a670c91d3c..d6414315c7 100644 --- a/src/MusicStore/StartupOpenIdConnect.cs +++ b/src/MusicStore/StartupOpenIdConnect.cs @@ -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); diff --git a/test/E2ETests/compiler/shared/Mocks/StartupOpenIdConnectTesting.cs b/test/E2ETests/compiler/shared/Mocks/StartupOpenIdConnectTesting.cs index 592a380483..dca6ffcd8a 100644 --- a/test/E2ETests/compiler/shared/Mocks/StartupOpenIdConnectTesting.cs +++ b/test/E2ETests/compiler/shared/Mocks/StartupOpenIdConnectTesting.cs @@ -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; diff --git a/test/E2ETests/compiler/shared/Mocks/StartupSocialTesting.cs b/test/E2ETests/compiler/shared/Mocks/StartupSocialTesting.cs index c5112d3bc3..e591880d8b 100644 --- a/test/E2ETests/compiler/shared/Mocks/StartupSocialTesting.cs +++ b/test/E2ETests/compiler/shared/Mocks/StartupSocialTesting.cs @@ -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;