1
0
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:
Kyle Spearrin
2017-08-25 10:59:27 -04:00
parent 9932c3b599
commit cde50f4e6f
3 changed files with 36 additions and 7 deletions

View File

@@ -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();