mirror of
https://github.com/bitwarden/server.git
synced 2025-05-21 03:24:31 -05:00
simplify secrets in startup via csproj tools
This commit is contained in:
parent
8b07244c95
commit
5ee0b4a9da
@ -27,4 +27,9 @@
|
|||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
|
||||||
|
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -25,18 +25,13 @@ namespace Bit.Api
|
|||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
public Startup(IHostingEnvironment env)
|
public Startup(IHostingEnvironment env, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
var builder = new ConfigurationBuilder();
|
Configuration = configuration;
|
||||||
if(env.IsDevelopment())
|
|
||||||
{
|
|
||||||
builder.AddUserSecrets("bitwarden-Api");
|
|
||||||
}
|
|
||||||
Configuration = builder.Build();
|
|
||||||
Environment = env;
|
Environment = env;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IConfigurationRoot Configuration { get; private set; }
|
public IConfiguration Configuration { get; private set; }
|
||||||
public IHostingEnvironment Environment { get; set; }
|
public IHostingEnvironment Environment { get; set; }
|
||||||
|
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
|
@ -25,4 +25,9 @@
|
|||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
|
||||||
|
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -16,17 +16,12 @@ namespace Bit.Billing
|
|||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
public Startup(IHostingEnvironment env)
|
public Startup(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
var builder = new ConfigurationBuilder();
|
Configuration = configuration;
|
||||||
if(env.IsDevelopment())
|
|
||||||
{
|
|
||||||
builder.AddUserSecrets("bitwarden-Billing");
|
|
||||||
}
|
|
||||||
Configuration = builder.Build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IConfigurationRoot Configuration { get; }
|
public IConfiguration Configuration { get; }
|
||||||
|
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
|
@ -259,10 +259,10 @@ namespace Bit.Core.Utilities
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static GlobalSettings AddGlobalSettingsServices(this IServiceCollection services,
|
public static GlobalSettings AddGlobalSettingsServices(this IServiceCollection services,
|
||||||
IConfigurationRoot root)
|
IConfiguration configuration)
|
||||||
{
|
{
|
||||||
var globalSettings = new GlobalSettings();
|
var globalSettings = new GlobalSettings();
|
||||||
ConfigurationBinder.Bind(root.GetSection("GlobalSettings"), globalSettings);
|
ConfigurationBinder.Bind(configuration.GetSection("GlobalSettings"), globalSettings);
|
||||||
services.AddSingleton(s => globalSettings);
|
services.AddSingleton(s => globalSettings);
|
||||||
return globalSettings;
|
return globalSettings;
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
<RootNamespace>Bit.Icons</RootNamespace>
|
<RootNamespace>Bit.Icons</RootNamespace>
|
||||||
|
<UserSecretsId>bitwarden-Icons</UserSecretsId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -15,6 +16,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
|
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
|
||||||
|
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -18,4 +18,9 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
|
||||||
|
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -13,18 +13,13 @@ namespace Bit.Identity
|
|||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
public Startup(IHostingEnvironment env)
|
public Startup(IHostingEnvironment env, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
var builder = new ConfigurationBuilder();
|
Configuration = configuration;
|
||||||
if(env.IsDevelopment())
|
|
||||||
{
|
|
||||||
builder.AddUserSecrets("bitwarden-Identity");
|
|
||||||
}
|
|
||||||
Configuration = builder.Build();
|
|
||||||
Environment = env;
|
Environment = env;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IConfigurationRoot Configuration { get; private set; }
|
public IConfiguration Configuration { get; private set; }
|
||||||
public IHostingEnvironment Environment { get; set; }
|
public IHostingEnvironment Environment { get; set; }
|
||||||
|
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
|
@ -23,4 +23,8 @@
|
|||||||
<ProjectReference Include="..\Core\Core.csproj" />
|
<ProjectReference Include="..\Core\Core.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -16,4 +16,8 @@
|
|||||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
|
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -10,4 +10,8 @@
|
|||||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
|
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user