2022-06-30 01:46:41 +02:00
|
|
|
|
namespace Bit.Server;
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
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
|
|
|
|
|
2017-08-25 16:59:27 +02:00
|
|
|
|
var builder = new WebHostBuilder()
|
|
|
|
|
.UseConfiguration(config)
|
|
|
|
|
.UseKestrel()
|
|
|
|
|
.UseStartup<Startup>()
|
|
|
|
|
.ConfigureLogging((hostingContext, logging) =>
|
2017-08-15 18:03:55 +02:00
|
|
|
|
{
|
2020-11-03 20:29:07 +01:00
|
|
|
|
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");
|
2020-03-27 19:36:37 +01:00
|
|
|
|
if (!string.IsNullOrWhiteSpace(contentRoot))
|
2017-08-15 18:03:55 +02:00
|
|
|
|
{
|
2017-08-25 16:59:27 +02:00
|
|
|
|
builder.UseContentRoot(contentRoot);
|
2022-08-29 22:06:55 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-03 20:29:07 +01:00
|
|
|
|
builder.UseContentRoot(Directory.GetCurrentDirectory());
|
2017-08-15 18:03:55 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var webRoot = config.GetValue<string>("webRoot");
|
2017-08-25 16:59:27 +02:00
|
|
|
|
if (string.IsNullOrWhiteSpace(webRoot))
|
2022-08-29 22:06:55 +02:00
|
|
|
|
{
|
2017-08-15 18:03:55 +02:00
|
|
|
|
builder.UseWebRoot(webRoot);
|
|
|
|
|
}
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2017-08-25 16:59:27 +02:00
|
|
|
|
var host = builder.Build();
|
2017-08-15 18:03:55 +02:00
|
|
|
|
host.Run();
|
|
|
|
|
}
|
|
|
|
|
}
|