React to aspnet/Configuration #195,#198

This commit is contained in:
Kirthi Krishnamraju 2015-05-20 23:40:16 -07:00
parent 5694f79af4
commit 7968239891
11 changed files with 24 additions and 20 deletions

View File

@ -3,7 +3,7 @@ using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Data.Entity;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Runtime;
using MusicStore.Apis;
@ -15,12 +15,12 @@ namespace MusicStore.Spa
{
public Startup(IApplicationEnvironment env)
{
Configuration = new Configuration(env.ApplicationBasePath)
Configuration = new ConfigurationSection(env.ApplicationBasePath)
.AddJsonFile("Config.json")
.AddEnvironmentVariables();
}
public Microsoft.Framework.ConfigurationModel.IConfiguration Configuration { get; set; }
public Microsoft.Framework.Configuration.IConfiguration Configuration { get; set; }
public void ConfigureServices(IServiceCollection services)
{

View File

@ -33,8 +33,9 @@
"EntityFramework.SqlServer": "7.0.0-*",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-*",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-*",
"Microsoft.Framework.ConfigurationModel": "1.0.0-*",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-*",
"Microsoft.Framework.Configuration": "1.0.0-*",
"Microsoft.Framework.Configuration.EnvironmentVariables": "1.0.0-*",
"Microsoft.Framework.Configuration.Json": "1.0.0-*",
"AutoMapper": "4.0.0-ci1026"
},
"commands": {

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using Microsoft.AspNet.Identity;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Relational;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Runtime;
@ -89,7 +89,7 @@ namespace MusicStore.Models
{
var appEnv = serviceProvider.GetService<IApplicationEnvironment>();
var configuration = new Configuration(appEnv.ApplicationBasePath)
var configuration = new ConfigurationSection(appEnv.ApplicationBasePath)
.AddJsonFile("config.json")
.AddEnvironmentVariables();

View File

@ -1,7 +1,7 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNet.Hosting;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
namespace MusicStore
{
@ -21,7 +21,7 @@ namespace MusicStore
public Task<int> Main(string[] args)
{
//Add command line configuration source to read command line parameters.
var config = new Configuration();
var config = new ConfigurationSection();
config.AddCommandLine(args);
using (new WebHostBuilder(_serviceProvider, config)

View File

@ -6,7 +6,7 @@ using Microsoft.AspNet.Diagnostics.Entity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Data.Entity;
using Microsoft.Framework.Caching.Memory;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Logging;
using Microsoft.Framework.Runtime;
@ -23,7 +23,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(env.ApplicationBasePath)
Configuration = new ConfigurationSection(env.ApplicationBasePath)
.AddJsonFile("config.json")
.AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values.

View File

@ -7,7 +7,7 @@ using Microsoft.AspNet.Diagnostics.Entity;
using Microsoft.AspNet.Server.WebListener;
using Microsoft.Data.Entity;
using Microsoft.Framework.Caching.Memory;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Logging;
using Microsoft.Framework.Runtime;
@ -36,7 +36,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(env.ApplicationBasePath)
Configuration = new ConfigurationSection(env.ApplicationBasePath)
.AddJsonFile("config.json")
.AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values.
}

View File

@ -6,7 +6,7 @@ using Microsoft.AspNet.Diagnostics.Entity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Data.Entity;
using Microsoft.Framework.Caching.Memory;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Logging;
using Microsoft.Framework.Runtime;
@ -36,7 +36,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(env.ApplicationBasePath)
Configuration = new ConfigurationSection(env.ApplicationBasePath)
.AddJsonFile("config.json")
.AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values.

View File

@ -33,7 +33,9 @@
"Microsoft.AspNet.Tooling.Razor": "1.0.0-*",
"Microsoft.Framework.Caching.Distributed": "1.0.0-*",
"Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-*",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-*",
"Microsoft.Framework.Configuration.CommandLine": "1.0.0-*",
"Microsoft.Framework.Configuration.EnvironmentVariables": "1.0.0-*",
"Microsoft.Framework.Configuration.Json": "1.0.0-*",
"Microsoft.Framework.Logging.Console": "1.0.0-*"
},
"commands": {

View File

@ -8,7 +8,7 @@ using Microsoft.AspNet.Diagnostics.Entity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Data.Entity;
using Microsoft.Framework.Caching.Memory;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Logging;
using Microsoft.Framework.Runtime;
@ -27,7 +27,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(env.ApplicationBasePath)
Configuration = new ConfigurationSection(env.ApplicationBasePath)
.AddJsonFile("config.json")
.AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values.

View File

@ -11,7 +11,7 @@ using Microsoft.AspNet.Diagnostics.Entity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Data.Entity;
using Microsoft.Framework.Caching.Memory;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Logging;
using Microsoft.Framework.Runtime;
@ -33,7 +33,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(appEnvironment.ApplicationBasePath)
Configuration = new ConfigurationSection(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.

View File

@ -10,6 +10,7 @@
"Microsoft.AspNet.Server.Testing": "1.0.0-*",
"Microsoft.AspNet.SignalR.Client": "2.1.1",
"Microsoft.AspNet.WebUtilities": "1.0.0-*",
"Microsoft.Framework.Configuration.EnvironmentVariables": "1.0.0-*",
"Microsoft.Framework.Logging.Console": "1.0.0-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
},