mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 07:36:14 -05:00
convert more services to local resources
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user