You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.0 KiB
40 lines
1.0 KiB
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>() |
|
.ConfigureLogging((hostingContext, logging) => |
|
{ |
|
logging.AddConsole().AddDebug(); |
|
}) |
|
.ConfigureKestrel((context, options) => { }); |
|
|
|
var contentRoot = config.GetValue<string>("contentRoot"); |
|
if (!string.IsNullOrWhiteSpace(contentRoot)) |
|
{ |
|
builder.UseContentRoot(contentRoot); |
|
} |
|
else |
|
{ |
|
builder.UseContentRoot(Directory.GetCurrentDirectory()); |
|
} |
|
|
|
var webRoot = config.GetValue<string>("webRoot"); |
|
if (string.IsNullOrWhiteSpace(webRoot)) |
|
{ |
|
builder.UseWebRoot(webRoot); |
|
} |
|
|
|
var host = builder.Build(); |
|
host.Run(); |
|
} |
|
}
|
|
|