React to configuration model change
This commit is contained in:
parent
25a68f9f79
commit
dcac97fe3b
|
|
@ -5,17 +5,17 @@ using Microsoft.AspNet.Identity.EntityFramework;
|
|||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Framework.ConfigurationModel;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.Runtime;
|
||||
using MusicStore.Apis;
|
||||
using MusicStore.Models;
|
||||
|
||||
|
||||
namespace MusicStore.Spa
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public Startup()
|
||||
public Startup(IApplicationEnvironment env)
|
||||
{
|
||||
Configuration = new Configuration()
|
||||
Configuration = new Configuration(env.ApplicationBasePath)
|
||||
.AddJsonFile("Config.json")
|
||||
.AddEnvironmentVariables();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using Microsoft.Data.Entity;
|
|||
using Microsoft.Data.Entity.SqlServer;
|
||||
using Microsoft.Framework.ConfigurationModel;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.Runtime;
|
||||
|
||||
namespace MusicStore.Models
|
||||
{
|
||||
|
|
@ -86,7 +87,9 @@ namespace MusicStore.Models
|
|||
/// <returns></returns>
|
||||
private static async Task CreateAdminUser(IServiceProvider serviceProvider)
|
||||
{
|
||||
var configuration = new Configuration()
|
||||
var appEnv = serviceProvider.GetService<IApplicationEnvironment>();
|
||||
|
||||
var configuration = new Configuration(appEnv.ApplicationBasePath)
|
||||
.AddJsonFile("config.json")
|
||||
.AddEnvironmentVariables();
|
||||
|
||||
|
|
|
|||
|
|
@ -9,17 +9,18 @@ using Microsoft.Framework.Caching.Memory;
|
|||
using Microsoft.Framework.ConfigurationModel;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.Logging;
|
||||
using Microsoft.Framework.Runtime;
|
||||
using MusicStore.Models;
|
||||
|
||||
namespace MusicStore
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public Startup()
|
||||
public Startup(IApplicationEnvironment env)
|
||||
{
|
||||
//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.
|
||||
Configuration = new Configuration()
|
||||
Configuration = new Configuration(env.ApplicationBasePath)
|
||||
.AddJsonFile("config.json")
|
||||
.AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using Microsoft.Framework.Caching.Memory;
|
|||
using Microsoft.Framework.ConfigurationModel;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.Logging;
|
||||
using Microsoft.Framework.Runtime;
|
||||
using Microsoft.Net.Http.Server;
|
||||
using MusicStore.Models;
|
||||
|
||||
|
|
@ -30,11 +31,11 @@ namespace MusicStore
|
|||
/// </summary>
|
||||
public class StartupNtlmAuthentication
|
||||
{
|
||||
public StartupNtlmAuthentication()
|
||||
public StartupNtlmAuthentication(IApplicationEnvironment env)
|
||||
{
|
||||
//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.
|
||||
Configuration = new Configuration()
|
||||
Configuration = new Configuration(env.ApplicationBasePath)
|
||||
.AddJsonFile("config.json")
|
||||
.AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ using Microsoft.Framework.Caching.Memory;
|
|||
using Microsoft.Framework.ConfigurationModel;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.Logging;
|
||||
using Microsoft.Framework.Runtime;
|
||||
using MusicStore.Models;
|
||||
|
||||
namespace MusicStore
|
||||
|
|
@ -28,11 +29,11 @@ namespace MusicStore
|
|||
/// </summary>
|
||||
public class StartupOpenIdConnect
|
||||
{
|
||||
public StartupOpenIdConnect()
|
||||
public StartupOpenIdConnect(IApplicationEnvironment env)
|
||||
{
|
||||
//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.
|
||||
Configuration = new Configuration()
|
||||
Configuration = new Configuration(env.ApplicationBasePath)
|
||||
.AddJsonFile("config.json")
|
||||
.AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using Microsoft.Framework.Caching.Memory;
|
|||
using Microsoft.Framework.ConfigurationModel;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.Logging;
|
||||
using Microsoft.Framework.Runtime;
|
||||
using MusicStore.Mocks.Common;
|
||||
using MusicStore.Mocks.OpenIdConnect;
|
||||
using MusicStore.Models;
|
||||
|
|
@ -18,11 +19,11 @@ namespace MusicStore
|
|||
{
|
||||
public class StartupOpenIdConnectTesting
|
||||
{
|
||||
public StartupOpenIdConnectTesting()
|
||||
public StartupOpenIdConnectTesting(IApplicationEnvironment env)
|
||||
{
|
||||
//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.
|
||||
Configuration = new Configuration()
|
||||
Configuration = new Configuration(env.ApplicationBasePath)
|
||||
.AddJsonFile("config.json")
|
||||
.AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ 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.
|
||||
Configuration = new Configuration()
|
||||
Configuration = new Configuration(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.
|
||||
|
|
|
|||
Loading…
Reference in New Issue