mirror of
https://github.com/bitwarden/server
synced 2025-12-11 22:03:38 +00:00
command config for server, serve unknown files
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
@@ -6,18 +7,25 @@ namespace Server
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var config = new ConfigurationBuilder()
|
||||
.AddCommandLine(args)
|
||||
.Build();
|
||||
|
||||
var builder = new WebHostBuilder()
|
||||
.UseConfiguration(config)
|
||||
.UseKestrel()
|
||||
.UseStartup<Startup>();
|
||||
|
||||
if(args.Length > 0)
|
||||
var contentRoot = config.GetValue<string>("contentRoot");
|
||||
if(string.IsNullOrWhiteSpace(contentRoot))
|
||||
{
|
||||
builder.UseContentRoot(args[0]);
|
||||
builder.UseContentRoot(contentRoot);
|
||||
}
|
||||
|
||||
if(args.Length > 1)
|
||||
var webRoot = config.GetValue<string>("webRoot");
|
||||
if(string.IsNullOrWhiteSpace(webRoot))
|
||||
{
|
||||
builder.UseWebRoot(args[1]);
|
||||
builder.UseWebRoot(webRoot);
|
||||
}
|
||||
|
||||
var host = builder.Build();
|
||||
|
||||
Reference in New Issue
Block a user