1
0
mirror of https://github.com/bitwarden/server.git synced 2025-01-22 21:51:22 +01:00

simplify secrets in startup via csproj tools

This commit is contained in:
Kyle Spearrin 2017-10-19 00:08:09 -04:00
parent 8b07244c95
commit 5ee0b4a9da
11 changed files with 40 additions and 26 deletions

View File

@ -27,4 +27,9 @@
<Reference Include="Microsoft.CSharp" />
</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>

View File

@ -25,18 +25,13 @@ namespace Bit.Api
{
public class Startup
{
public Startup(IHostingEnvironment env)
public Startup(IHostingEnvironment env, IConfiguration configuration)
{
var builder = new ConfigurationBuilder();
if(env.IsDevelopment())
{
builder.AddUserSecrets("bitwarden-Api");
}
Configuration = builder.Build();
Configuration = configuration;
Environment = env;
}
public IConfigurationRoot Configuration { get; private set; }
public IConfiguration Configuration { get; private set; }
public IHostingEnvironment Environment { get; set; }
public void ConfigureServices(IServiceCollection services)

View File

@ -25,4 +25,9 @@
<Reference Include="Microsoft.CSharp" />
</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>

View File

@ -16,17 +16,12 @@ namespace Bit.Billing
{
public class Startup
{
public Startup(IHostingEnvironment env)
public Startup(IConfiguration configuration)
{
var builder = new ConfigurationBuilder();
if(env.IsDevelopment())
{
builder.AddUserSecrets("bitwarden-Billing");
}
Configuration = builder.Build();
Configuration = configuration;
}
public IConfigurationRoot Configuration { get; }
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{

View File

@ -259,10 +259,10 @@ namespace Bit.Core.Utilities
}
public static GlobalSettings AddGlobalSettingsServices(this IServiceCollection services,
IConfigurationRoot root)
IConfiguration configuration)
{
var globalSettings = new GlobalSettings();
ConfigurationBinder.Bind(root.GetSection("GlobalSettings"), globalSettings);
ConfigurationBinder.Bind(configuration.GetSection("GlobalSettings"), globalSettings);
services.AddSingleton(s => globalSettings);
return globalSettings;
}

View File

@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RootNamespace>Bit.Icons</RootNamespace>
<UserSecretsId>bitwarden-Icons</UserSecretsId>
</PropertyGroup>
<ItemGroup>
@ -15,6 +16,7 @@
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
</ItemGroup>
</Project>

View File

@ -18,4 +18,9 @@
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
</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>

View File

@ -13,18 +13,13 @@ namespace Bit.Identity
{
public class Startup
{
public Startup(IHostingEnvironment env)
public Startup(IHostingEnvironment env, IConfiguration configuration)
{
var builder = new ConfigurationBuilder();
if(env.IsDevelopment())
{
builder.AddUserSecrets("bitwarden-Identity");
}
Configuration = builder.Build();
Configuration = configuration;
Environment = env;
}
public IConfigurationRoot Configuration { get; private set; }
public IConfiguration Configuration { get; private set; }
public IHostingEnvironment Environment { get; set; }
public void ConfigureServices(IServiceCollection services)

View File

@ -23,4 +23,8 @@
<ProjectReference Include="..\Core\Core.csproj" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup>
</Project>

View File

@ -16,4 +16,8 @@
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup>
</Project>

View File

@ -10,4 +10,8 @@
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup>
</Project>