IW4M-Admin/WebfrontCore/Program.cs
RaidMax 438718507b more api tweaks
removed WebfrontSettings
IW4MAdminSettings are only generated when the file does not exist, placeholder values stored in DefaultSettings.json
2018-04-19 00:48:14 -05:00

42 lines
1.1 KiB
C#

using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using SharedLibraryCore.Interfaces;
namespace WebfrontCore
{
public class Program
{
public static IManager Manager;
static void Main(string[] args)
{
throw new System.Exception("Webfront core cannot be run as a standalone application");
}
public static void Init(IManager mgr)
{
Manager = mgr;
BuildWebHost().Run();
}
public static IWebHost BuildWebHost()
{
var config = new ConfigurationBuilder()
.AddEnvironmentVariables()
.Build();
return new WebHostBuilder()
#if DEBUG
.UseContentRoot(Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), @"..\..\..\..\", "WebfrontCore")))
#else
.UseContentRoot(Directory.GetCurrentDirectory())
#endif
.UseUrls(Manager.GetApplicationSettings().Configuration().WebfrontBindUrl)
.UseKestrel()
.UseStartup<Startup>()
.Build();
}
}
}