Keeping Secrets in Dotnet Core

dotnet run --environment "Staging"
"profiles": {"MyWebApplication": {"commandName": "MyProject","launchBrowser": true,"applicationUrl": "http://localhost:54321","environmentVariables": {"ASPNETCORE_ENVIRONMENT": "Development"
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);

Configuration = builder.Build();
}
# ignore appsettings configuration files
**/appsettings.development.json
**/appsettings.SomeOtherEnvironment.json
**/appsettings.production.json

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store