Skip to content

Instantly share code, notes, and snippets.

@JoeWirtley
Last active July 3, 2020 17:52
Show Gist options
  • Save JoeWirtley/e28d8d361e6d6b3997cda61345027bb7 to your computer and use it in GitHub Desktop.
Save JoeWirtley/e28d8d361e6d6b3997cda61345027bb7 to your computer and use it in GitHub Desktop.
.NET Core Startup Configuration (including user specific settings)
public Startup(IHostingEnvironment env) {
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddJsonFile($"appsettings.{Environment.UserName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment