Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public IConfigurationRoot Configuration { get; }
public Startup(IHostingEnvironment env)
_env = env;
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
if (env.IsDevelopment())
Configuration = builder.Build();
// From our User Secret
var connStr = Configuration["ConnStr"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment