mirror of
https://github.com/bitwarden/server.git
synced 2024-11-25 12:45:18 +01:00
convert more services to local resources
This commit is contained in:
parent
e081213615
commit
7590ea37f9
@ -2,6 +2,7 @@
|
||||
"globalSettings": {
|
||||
"selfHosted": false,
|
||||
"siteName": "bitwarden",
|
||||
"projectName": "Api",
|
||||
"stripeApiKey": "SECRET",
|
||||
"baseServiceUri": {
|
||||
"vault": "http://localhost:4001",
|
||||
|
@ -2,6 +2,7 @@
|
||||
"globalSettings": {
|
||||
"selfHosted": false,
|
||||
"siteName": "bitwarden",
|
||||
"projectName": "Billing",
|
||||
"stripeApiKey": "SECRET",
|
||||
"baseServiceUri": {
|
||||
"vault": "http://localhost:4001",
|
||||
|
@ -51,6 +51,7 @@
|
||||
<PackageReference Include="RazorLight" Version="1.1.0" />
|
||||
<PackageReference Include="Sendgrid" Version="9.5.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="1.4.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging.File" Version="1.1.0" />
|
||||
<PackageReference Include="Serilog.Sinks.AzureDocumentDB" Version="3.6.1" />
|
||||
<PackageReference Include="Stripe.net" Version="7.8.0" />
|
||||
<PackageReference Include="U2F.Core" Version="1.0.3" />
|
||||
|
@ -5,6 +5,8 @@
|
||||
public bool SelfHosted { get; set; }
|
||||
public virtual string SiteName { get; set; }
|
||||
public virtual string StripeApiKey { get; set; }
|
||||
public virtual string ProjectName { get; set; }
|
||||
public virtual string LogDirectory { get; set; }
|
||||
public virtual BaseServiceUriSettings BaseServiceUri { get; set; } = new BaseServiceUriSettings();
|
||||
public virtual SqlServerSettings SqlServer { get; set; } = new SqlServerSettings();
|
||||
public virtual MailSettings Mail { get; set; } = new MailSettings();
|
||||
@ -68,6 +70,7 @@
|
||||
public class DataProtectionSettings
|
||||
{
|
||||
public string CertificateThumbprint { get; set; }
|
||||
public string Directory { get; set; }
|
||||
}
|
||||
|
||||
public class DocumentDbSettings
|
||||
|
@ -280,7 +280,7 @@ namespace Bit.Core.Utilities
|
||||
|
||||
public static bool SettingHasValue(string setting)
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(setting) || setting.Equals("SECRET"))
|
||||
if(string.IsNullOrWhiteSpace(setting) || setting.Equals("SECRET") || setting.Equals("REPLACE"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -26,15 +26,15 @@ namespace Bit.Core.Utilities
|
||||
.Enrich.FromLogContext()
|
||||
.Filter.ByIncludingOnly(filter);
|
||||
|
||||
if(globalSettings.DocumentDb != null && !string.IsNullOrWhiteSpace(globalSettings.DocumentDb.Uri) &&
|
||||
!string.IsNullOrWhiteSpace(globalSettings.DocumentDb.Key))
|
||||
if(globalSettings.DocumentDb != null && CoreHelpers.SettingHasValue(globalSettings.DocumentDb.Uri) &&
|
||||
CoreHelpers.SettingHasValue(globalSettings.DocumentDb.Key))
|
||||
{
|
||||
config.WriteTo.AzureDocumentDB(new Uri(globalSettings.DocumentDb.Uri), globalSettings.DocumentDb.Key,
|
||||
timeToLive: TimeSpan.FromDays(7));
|
||||
}
|
||||
else
|
||||
else if(CoreHelpers.SettingHasValue(globalSettings.LogDirectory))
|
||||
{
|
||||
// local file sink
|
||||
config.WriteTo.RollingFile($"{globalSettings.LogDirectory}/{globalSettings.ProjectName}/{{Date}}.txt");
|
||||
}
|
||||
|
||||
var serilog = config.CreateLogger();
|
||||
|
@ -222,10 +222,10 @@ namespace Bit.Core.Utilities
|
||||
return;
|
||||
}
|
||||
|
||||
if(globalSettings.SelfHosted)
|
||||
if(globalSettings.SelfHosted && CoreHelpers.SettingHasValue(globalSettings.DataProtection.Directory))
|
||||
{
|
||||
var dir = new DirectoryInfo("/etc/bitwarden/core/aspnet-dataprotection");
|
||||
services.AddDataProtection().PersistKeysToFileSystem(dir);
|
||||
services.AddDataProtection()
|
||||
.PersistKeysToFileSystem(new DirectoryInfo(globalSettings.DataProtection.Directory));
|
||||
}
|
||||
|
||||
#if NET461
|
||||
|
@ -2,6 +2,7 @@
|
||||
"globalSettings": {
|
||||
"selfHosted": false,
|
||||
"siteName": "bitwarden",
|
||||
"projectName": "Identity",
|
||||
"stripeApiKey": "SECRET",
|
||||
"baseServiceUri": {
|
||||
"vault": "http://localhost:4001",
|
||||
|
@ -10,6 +10,7 @@ namespace Setup
|
||||
{
|
||||
private static string[] _args = null;
|
||||
private static IDictionary<string, string> _parameters = null;
|
||||
private static string _outputDir = null;
|
||||
private static string _domain = null;
|
||||
private static string _url = null;
|
||||
private static string _identityCertPassword = null;
|
||||
@ -22,6 +23,8 @@ namespace Setup
|
||||
_args = args;
|
||||
_parameters = ParseParameters();
|
||||
|
||||
_outputDir = _parameters.ContainsKey("out") ?
|
||||
_parameters["out"].ToLowerInvariant() : "/etc/bitwarden";
|
||||
_domain = _parameters.ContainsKey("domain") ?
|
||||
_parameters["domain"].ToLowerInvariant() : "localhost";
|
||||
_letsEncrypt = _parameters.ContainsKey("letsencrypt") ?
|
||||
@ -253,8 +256,10 @@ globalSettings:baseServiceUri:api={_url}/api
|
||||
globalSettings:baseServiceUri:identity={_url}/identity
|
||||
globalSettings:sqlServer:connectionString={dbConnectionString}
|
||||
globalSettings:identityServer:certificatePassword={_identityCertPassword}
|
||||
globalSettings:attachment:baseDirectory=/etc/bitwarden/core/attachments
|
||||
globalSettings:attachment:baseDirectory={_outputDir}/core/attachments
|
||||
globalSettings:attachment:baseUrl={_url}/attachments
|
||||
globalSettings:dataProtection:directory={_outputDir}/core/aspnet-dataprotection
|
||||
globalSettings:logDirectory={_outputDir}/core/logs
|
||||
globalSettings:duo:aKey={Helpers.SecureRandomString(32, alpha: true, numeric: true)}
|
||||
globalSettings:yubico:clientId=REPLACE
|
||||
globalSettings:yubico:REPLACE");
|
||||
|
Loading…
Reference in New Issue
Block a user