mirror of
https://github.com/bitwarden/server.git
synced 2025-05-11 22:52:15 -05:00
Add other services
This commit is contained in:
parent
49ad409999
commit
acae59429b
@ -4,6 +4,7 @@ using Bit.Core.Settings;
|
|||||||
using Bit.Migrator;
|
using Bit.Migrator;
|
||||||
using Bit.Setup.Enums;
|
using Bit.Setup.Enums;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
|
||||||
namespace Bit.Setup;
|
namespace Bit.Setup;
|
||||||
|
|
||||||
@ -292,6 +293,8 @@ public class Program
|
|||||||
.AddX509ChainCustomization()
|
.AddX509ChainCustomization()
|
||||||
// Setup is always ran for self hosted, so it's fine to hard code this to true and allow chain customization
|
// Setup is always ran for self hosted, so it's fine to hard code this to true and allow chain customization
|
||||||
.AddSingleton(new GlobalSettings { SelfHosted = true })
|
.AddSingleton(new GlobalSettings { SelfHosted = true })
|
||||||
|
.AddLogging()
|
||||||
|
.AddSingleton<IHostEnvironment>(new SetupHostEnvironment())
|
||||||
.BuildServiceProvider()
|
.BuildServiceProvider()
|
||||||
.GetRequiredService<IHttpClientFactory>()
|
.GetRequiredService<IHttpClientFactory>()
|
||||||
.CreateClient();
|
.CreateClient();
|
||||||
@ -321,9 +324,12 @@ public class Program
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Unable to validate installation id. Problem contacting Bitwarden {cloudRegion.ToString()} server.");
|
// TODO: Remove exception message before main merge??
|
||||||
|
Console.WriteLine(
|
||||||
|
$"Unable to validate installation id. Problem contacting Bitwarden {cloudRegion.ToString()} server.\nError: {ex.Message}"
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
12
util/Setup/SetupHostEnvironment.cs
Normal file
12
util/Setup/SetupHostEnvironment.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using Microsoft.Extensions.FileProviders;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
|
||||||
|
namespace Bit.Setup;
|
||||||
|
|
||||||
|
internal class SetupHostEnvironment : IHostEnvironment
|
||||||
|
{
|
||||||
|
public string ApplicationName { get; set; } = "Setup";
|
||||||
|
public IFileProvider ContentRootFileProvider { get; set; } = new NullFileProvider();
|
||||||
|
public string ContentRootPath { get; set; } = string.Empty;
|
||||||
|
public string EnvironmentName { get; set; } = "Production";
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user