-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
Needs: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.This issue needs the attention of a contributor, typically because the OP has provided an update.area-hostingIncludes HostingIncludes Hostingarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Description
Currently CreateDefaultBuilder() adds UserSecrets only for Development env.
https://github.com/dotnet/aspnetcore/blob/master/src/DefaultBuilder/src/WebHost.cs
if (env.IsDevelopment())
{
var appAssembly = Assembly.Load(new AssemblyName(env.ApplicationName));
if (appAssembly != null)
{
config.AddUserSecrets(appAssembly, optional: true);
}
}Solution
I would like to have UserSecrets also for Local env.
if (env.IsDevelopment() || env.IsEnvironment("Local")) // or env.IsLocal() would be even better with a bit more changes
{
var appAssembly = Assembly.Load(new AssemblyName(env.ApplicationName));
if (appAssembly != null)
{
config.AddUserSecrets(appAssembly, optional: true);
}
}Additional context
Usually Development env is a first stage of deploying whole solution (like QA). But earlier we have Local development on local machine where we have own configuration of environment (ie docker, sql server, etc). This requires to have separate appsettings.Local.json file with local settings (ie urls, passwords, server names, queues etc). I don't want to commit my local secrets, so I'm using UserSecrets to keep them safe.
If you would like to I can create a PR for that.
Metadata
Metadata
Assignees
Labels
Needs: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.This issue needs the attention of a contributor, typically because the OP has provided an update.area-hostingIncludes HostingIncludes Hostingarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions