mirror of
https://github.com/bitwarden/server.git
synced 2025-02-22 02:51:33 +01:00
move to standard appsettings.json
This commit is contained in:
parent
045056389d
commit
8b07244c95
@ -27,8 +27,11 @@ namespace Bit.Api
|
||||
{
|
||||
public Startup(IHostingEnvironment env)
|
||||
{
|
||||
var builder = new ConfigurationBuilder()
|
||||
.AddSettingsConfiguration(env, "bitwarden-Api");
|
||||
var builder = new ConfigurationBuilder();
|
||||
if(env.IsDevelopment())
|
||||
{
|
||||
builder.AddUserSecrets("bitwarden-Api");
|
||||
}
|
||||
Configuration = builder.Build();
|
||||
Environment = env;
|
||||
}
|
||||
|
@ -18,8 +18,11 @@ namespace Bit.Billing
|
||||
{
|
||||
public Startup(IHostingEnvironment env)
|
||||
{
|
||||
var builder = new ConfigurationBuilder()
|
||||
.AddSettingsConfiguration(env, "bitwarden-Billing");
|
||||
var builder = new ConfigurationBuilder();
|
||||
if(env.IsDevelopment())
|
||||
{
|
||||
builder.AddUserSecrets("bitwarden-Billing");
|
||||
}
|
||||
Configuration = builder.Build();
|
||||
}
|
||||
|
||||
|
@ -1,25 +0,0 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Bit.Core.Utilities
|
||||
{
|
||||
public static class ConfigurationBuilderExtensions
|
||||
{
|
||||
public static IConfigurationBuilder AddSettingsConfiguration(
|
||||
this ConfigurationBuilder builder,
|
||||
IHostingEnvironment env,
|
||||
string userSecretsId)
|
||||
{
|
||||
builder.SetBasePath(env.ContentRootPath)
|
||||
.AddJsonFile("settings.json")
|
||||
.AddJsonFile($"settings.{env.EnvironmentName}.json", optional: true);
|
||||
|
||||
if(env.IsDevelopment() && !string.IsNullOrWhiteSpace(userSecretsId))
|
||||
{
|
||||
builder.AddUserSecrets(userSecretsId);
|
||||
}
|
||||
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
}
|
@ -15,8 +15,11 @@ namespace Bit.Identity
|
||||
{
|
||||
public Startup(IHostingEnvironment env)
|
||||
{
|
||||
var builder = new ConfigurationBuilder()
|
||||
.AddSettingsConfiguration(env, "bitwarden-Identity");
|
||||
var builder = new ConfigurationBuilder();
|
||||
if(env.IsDevelopment())
|
||||
{
|
||||
builder.AddUserSecrets("bitwarden-Identity");
|
||||
}
|
||||
Configuration = builder.Build();
|
||||
Environment = env;
|
||||
}
|
||||
|
@ -15,8 +15,17 @@ namespace Bit.Jobs
|
||||
public Startup(IHostingEnvironment env)
|
||||
{
|
||||
var builder = new ConfigurationBuilder()
|
||||
.AddSettingsConfiguration(env, "bitwarden-Jobs")
|
||||
.AddEnvironmentVariables();
|
||||
.SetBasePath(env.ContentRootPath)
|
||||
.AddJsonFile("appsettings.json")
|
||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
|
||||
|
||||
if(env.IsDevelopment())
|
||||
{
|
||||
builder.AddUserSecrets("bitwarden-Jobs");
|
||||
}
|
||||
|
||||
builder.AddEnvironmentVariables();
|
||||
|
||||
Configuration = builder.Build();
|
||||
Environment = env;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user