2017-08-15 18:03:55 +02:00
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
2017-08-25 16:59:27 +02:00
|
|
|
|
using Microsoft.Extensions.Configuration;
|
2019-07-23 22:38:49 +02:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
2017-08-15 18:03:55 +02:00
|
|
|
|
|
2017-09-08 17:45:20 +02:00
|
|
|
|
namespace Bit.Server
|
2017-08-15 18:03:55 +02:00
|
|
|
|
{
|
|
|
|
|
public class Program
|
|
|
|
|
{
|
|
|
|
|
public static void Main(string[] args)
|
|
|
|
|
{
|
2017-08-25 16:59:27 +02:00
|
|
|
|
var config = new ConfigurationBuilder()
|
|
|
|
|
.AddCommandLine(args)
|
|
|
|
|
.Build();
|
|
|
|
|
|
2017-08-15 18:03:55 +02:00
|
|
|
|
var builder = new WebHostBuilder()
|
2017-08-25 16:59:27 +02:00
|
|
|
|
.UseConfiguration(config)
|
2017-08-15 18:03:55 +02:00
|
|
|
|
.UseKestrel()
|
2019-07-23 22:38:49 +02:00
|
|
|
|
.UseStartup<Startup>()
|
|
|
|
|
.ConfigureLogging((hostingContext, logging) =>
|
|
|
|
|
{
|
|
|
|
|
logging.AddConsole().AddDebug();
|
|
|
|
|
})
|
|
|
|
|
.ConfigureKestrel((context, options) => { });
|
2017-08-15 18:03:55 +02:00
|
|
|
|
|
2017-08-25 16:59:27 +02:00
|
|
|
|
var contentRoot = config.GetValue<string>("contentRoot");
|
|
|
|
|
if(string.IsNullOrWhiteSpace(contentRoot))
|
2017-08-15 18:03:55 +02:00
|
|
|
|
{
|
2017-08-25 16:59:27 +02:00
|
|
|
|
builder.UseContentRoot(contentRoot);
|
2017-08-15 18:03:55 +02:00
|
|
|
|
}
|
|
|
|
|
|
2017-08-25 16:59:27 +02:00
|
|
|
|
var webRoot = config.GetValue<string>("webRoot");
|
|
|
|
|
if(string.IsNullOrWhiteSpace(webRoot))
|
2017-08-15 18:03:55 +02:00
|
|
|
|
{
|
2017-08-25 16:59:27 +02:00
|
|
|
|
builder.UseWebRoot(webRoot);
|
2017-08-15 18:03:55 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var host = builder.Build();
|
|
|
|
|
host.Run();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|