Prepopulate the environment rather than fall back to it.

This commit is contained in:
Chris R 2016-04-28 15:11:43 -07:00
parent 7fdc9271f4
commit e6bddd4131
2 changed files with 3 additions and 1 deletions

View File

@ -63,7 +63,6 @@ namespace Microsoft.AspNetCore.Hosting.Internal
hostingEnvironment.EnvironmentName =
options.Environment ??
Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ??
hostingEnvironment.EnvironmentName;
}
}

View File

@ -45,6 +45,9 @@ namespace Microsoft.AspNetCore.Hosting
_hostingEnvironment = new HostingEnvironment();
_configureServicesDelegates = new List<Action<IServiceCollection>>();
_configureLoggingDelegates = new List<Action<ILoggerFactory>>();
// This may end up storing null, but that's indistinguishable from not adding it.
UseSetting(WebHostDefaults.EnvironmentKey, Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"));
}
/// <summary>