1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00
bitwarden-server/util/Server/Program.cs
2018-08-06 16:42:55 -04:00

38 lines
1.0 KiB
C#

using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace Bit.Server
{
public class Program
{
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.AddCommandLine(args)
.Build();
var builder = new WebHostBuilder()
.UseConfiguration(config)
.UseKestrel()
.UseStartup<Startup>()
// ref: https://github.com/aspnet/KestrelHttpServer/issues/2694
.UseLibuv();
var contentRoot = config.GetValue<string>("contentRoot");
if(string.IsNullOrWhiteSpace(contentRoot))
{
builder.UseContentRoot(contentRoot);
}
var webRoot = config.GetValue<string>("webRoot");
if(string.IsNullOrWhiteSpace(webRoot))
{
builder.UseWebRoot(webRoot);
}
var host = builder.Build();
host.Run();
}
}
}