Files
server/test/Server.IntegrationTest/Server.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
1.1 KiB
C#
Raw Permalink Normal View History

2026-01-14 09:14:21 -05:00
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Testing;
2026-01-14 13:32:52 -05:00
using Microsoft.Extensions.Configuration;
namespace Bit.Server.IntegrationTest;
public class Server : WebApplicationFactory<Program>
{
public string? ContentRoot { get; set; }
public string? WebRoot { get; set; }
public bool ServeUnknown { get; set; }
public bool? WebVault { get; set; }
public string? AppIdLocation { get; set; }
2026-01-14 13:32:52 -05:00
protected override void ConfigureWebHost(IWebHostBuilder builder)
{
2026-01-14 13:32:52 -05:00
base.ConfigureWebHost(builder);
var config = new Dictionary<string, string?>
{
2026-01-14 13:32:52 -05:00
{"contentRoot", ContentRoot},
{"webRoot", WebRoot},
{"serveUnknown", ServeUnknown.ToString().ToLowerInvariant()},
};
if (WebVault.HasValue)
{
2026-01-14 13:32:52 -05:00
config["webVault"] = WebVault.Value.ToString().ToLowerInvariant();
}
if (!string.IsNullOrEmpty(AppIdLocation))
{
2026-01-14 13:32:52 -05:00
config["appIdLocation"] = AppIdLocation;
}
2026-01-14 13:32:52 -05:00
builder.UseConfiguration(new ConfigurationBuilder().AddInMemoryCollection(config).Build());
}
}