From b2edb0d4848c53ffe1ebf568ee9f997d42f493d6 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Tue, 10 Nov 2015 12:12:06 -0800 Subject: [PATCH] Fix environment variable loading in hosting #470 --- src/Microsoft.AspNet.Hosting/WebApplication.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Microsoft.AspNet.Hosting/WebApplication.cs b/src/Microsoft.AspNet.Hosting/WebApplication.cs index 33a834b1..f819fcec 100644 --- a/src/Microsoft.AspNet.Hosting/WebApplication.cs +++ b/src/Microsoft.AspNet.Hosting/WebApplication.cs @@ -80,8 +80,11 @@ public static void Run(Type startupType, string[] args) internal static IConfiguration LoadHostingConfiguration(string configJsonPath, string[] args) { + // We are adding all environment variables first and then adding the ASPNET_ ones + // with the prefix removed to unify with the command line and config file formats return new ConfigurationBuilder() .AddJsonFile(configJsonPath, optional: true) + .AddEnvironmentVariables() .AddEnvironmentVariables(prefix: EnvironmentVariablesPrefix) .AddCommandLine(args) .Build();