Files
server/util/Server/Program.cs
Justin Baur 550968bf41 Update to IHostBuilder style (#6843)
* Add some integration tests for the Server project

* Not sure why this project got removed?

* Format

* capture debug output

* Update tests to work with the now legacy WebHostBuilder

- I accidentally had the updated Program locally and that was why tests were working for me locally

* Formatting...again

* Update to `IHostBuilder` style

* Formatting
2026-03-27 11:09:05 -04:00

48 lines
1.3 KiB
C#

// FIXME: Update this file to be null safe and then delete the line below
#nullable disable
namespace Bit.Server;
public class Program
{
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.AddCommandLine(args)
.Build();
var builder = new HostBuilder()
.ConfigureWebHost(builder =>
{
builder.UseConfiguration(config);
builder.UseKestrel();
builder.UseStartup<Startup>();
builder.ConfigureKestrel((_, _) => { });
var webRoot = config.GetValue<string>("webRoot");
if (string.IsNullOrWhiteSpace(webRoot))
{
builder.UseWebRoot(webRoot);
}
})
.ConfigureLogging(logging =>
{
logging.AddConsole()
.AddDebug();
});
var contentRoot = config.GetValue<string>("contentRoot");
if (!string.IsNullOrWhiteSpace(contentRoot))
{
builder.UseContentRoot(contentRoot);
}
else
{
builder.UseContentRoot(Directory.GetCurrentDirectory());
}
var host = builder.Build();
host.Run();
}
}