2025-07-08 10:25:59 -04:00
|
|
|
|
// FIXME: Update this file to be null safe and then delete the line below
|
|
|
|
|
|
#nullable disable
|
|
|
|
|
|
|
|
|
|
|
|
namespace Bit.Server;
|
2022-08-29 16:06:55 -04:00
|
|
|
|
|
2017-08-15 12:03:55 -04:00
|
|
|
|
public class Program
|
|
|
|
|
|
{
|
|
|
|
|
|
public static void Main(string[] args)
|
|
|
|
|
|
{
|
2017-08-25 10:59:27 -04:00
|
|
|
|
var config = new ConfigurationBuilder()
|
|
|
|
|
|
.AddCommandLine(args)
|
|
|
|
|
|
.Build();
|
2017-08-15 12:03:55 -04:00
|
|
|
|
|
2026-01-14 13:32:52 -05:00
|
|
|
|
var builder = new HostBuilder()
|
|
|
|
|
|
.ConfigureWebHost(builder =>
|
2017-08-15 12:03:55 -04:00
|
|
|
|
{
|
2026-01-14 13:32:52 -05:00
|
|
|
|
builder.UseConfiguration(config);
|
|
|
|
|
|
builder.UseKestrel();
|
|
|
|
|
|
builder.UseStartup<Startup>();
|
2026-01-14 16:17:18 -05:00
|
|
|
|
builder.ConfigureKestrel((_, _) => { });
|
2026-01-14 13:32:52 -05:00
|
|
|
|
|
|
|
|
|
|
var webRoot = config.GetValue<string>("webRoot");
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(webRoot))
|
|
|
|
|
|
{
|
|
|
|
|
|
builder.UseWebRoot(webRoot);
|
|
|
|
|
|
}
|
2020-11-03 14:29:07 -05:00
|
|
|
|
})
|
2026-01-14 13:32:52 -05:00
|
|
|
|
.ConfigureLogging(logging =>
|
|
|
|
|
|
{
|
|
|
|
|
|
logging.AddConsole()
|
|
|
|
|
|
.AddDebug();
|
|
|
|
|
|
});
|
2017-08-15 12:03:55 -04:00
|
|
|
|
|
2017-08-25 10:59:27 -04:00
|
|
|
|
var contentRoot = config.GetValue<string>("contentRoot");
|
2020-03-27 14:36:37 -04:00
|
|
|
|
if (!string.IsNullOrWhiteSpace(contentRoot))
|
2017-08-15 12:03:55 -04:00
|
|
|
|
{
|
2017-08-25 10:59:27 -04:00
|
|
|
|
builder.UseContentRoot(contentRoot);
|
2022-08-29 16:06:55 -04:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2020-11-03 14:29:07 -05:00
|
|
|
|
builder.UseContentRoot(Directory.GetCurrentDirectory());
|
2017-08-15 12:03:55 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-14 13:32:52 -05:00
|
|
|
|
var host = builder.Build();
|
|
|
|
|
|
host.Run();
|
2017-08-15 12:03:55 -04:00
|
|
|
|
}
|
|
|
|
|
|
}
|