1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-07 12:42:24 -05:00

Add other services

This commit is contained in:
Justin Baur 2025-05-03 14:10:28 -04:00
parent 49ad409999
commit acae59429b
No known key found for this signature in database
2 changed files with 20 additions and 2 deletions

View File

@ -4,6 +4,7 @@ using Bit.Core.Settings;
using Bit.Migrator;
using Bit.Setup.Enums;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace Bit.Setup;
@ -292,6 +293,8 @@ public class Program
.AddX509ChainCustomization()
// 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 })
.AddLogging()
.AddSingleton<IHostEnvironment>(new SetupHostEnvironment())
.BuildServiceProvider()
.GetRequiredService<IHttpClientFactory>()
.CreateClient();
@ -321,9 +324,12 @@ public class Program
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;
}
}

View 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";
}