Skip to content

Instantly share code, notes, and snippets.

@subhankars
Last active July 20, 2019 16:53
Show Gist options
  • Save subhankars/5b41a5db8f91d62eafd20ef523de8c7c to your computer and use it in GitHub Desktop.
Save subhankars/5b41a5db8f91d62eafd20ef523de8c7c to your computer and use it in GitHub Desktop.
WebJob Program.cs
builder.ConfigureAppConfiguration((hostingContext, config) =>
{
var environmentName = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
Console.WriteLine("Environment Variable: " + environmentName);
var env = hostingContext.HostingEnvironment;
Console.WriteLine("hostingContext.HostingEnvironment: " + env.EnvironmentName);
config.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile($"appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{environmentName}.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables().Build();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment