1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-25 12:45:18 +01:00
bitwarden-server/util/Server/Program.cs

41 lines
1.0 KiB
C#
Raw Normal View History

2022-08-29 22:06:55 +02:00
namespace Bit.Server;
public class Program
{
2022-08-29 22:06:55 +02:00
public static void Main(string[] args)
{
2022-08-29 22:06:55 +02:00
var config = new ConfigurationBuilder()
.AddCommandLine(args)
.Build();
2022-08-29 22:06:55 +02:00
var builder = new WebHostBuilder()
.UseConfiguration(config)
.UseKestrel()
.UseStartup<Startup>()
.ConfigureLogging((hostingContext, logging) =>
{
2022-08-29 22:06:55 +02:00
logging.AddConsole().AddDebug();
})
.ConfigureKestrel((context, options) => { });
2022-08-29 22:06:55 +02:00
var contentRoot = config.GetValue<string>("contentRoot");
if (!string.IsNullOrWhiteSpace(contentRoot))
{
builder.UseContentRoot(contentRoot);
}
else
{
builder.UseContentRoot(Directory.GetCurrentDirectory());
}
2022-08-29 22:06:55 +02:00
var webRoot = config.GetValue<string>("webRoot");
if (string.IsNullOrWhiteSpace(webRoot))
{
builder.UseWebRoot(webRoot);
}
2022-08-29 22:06:55 +02:00
var host = builder.Build();
host.Run();
}
}