2021-08-01 19:22:23 +00:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
using Autofac.Extensions.DependencyInjection;
|
2020-01-26 00:27:45 +00:00
|
|
|
|
|
2019-07-09 18:39:29 +00:00
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
2020-08-27 21:35:47 +00:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2020-01-26 00:27:45 +00:00
|
|
|
|
using Microsoft.Extensions.Hosting;
|
2019-07-09 18:39:29 +00:00
|
|
|
|
|
2020-02-12 14:16:19 +00:00
|
|
|
|
using PluralKit.Core;
|
|
|
|
|
|
2020-08-27 21:36:02 +00:00
|
|
|
|
using Serilog;
|
|
|
|
|
|
2019-07-09 18:39:29 +00:00
|
|
|
|
namespace PluralKit.API
|
|
|
|
|
{
|
|
|
|
|
public class Program
|
|
|
|
|
{
|
2021-08-01 19:22:23 +00:00
|
|
|
|
public static async Task Main(string[] args)
|
2019-07-09 18:39:29 +00:00
|
|
|
|
{
|
2020-06-13 17:36:43 +00:00
|
|
|
|
InitUtils.InitStatic();
|
2021-08-01 19:22:23 +00:00
|
|
|
|
await BuildInfoService.LoadVersion();
|
|
|
|
|
await CreateHostBuilder(args).Build().RunAsync();
|
2019-07-09 18:39:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-01-26 00:27:45 +00:00
|
|
|
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
|
|
|
|
Host.CreateDefaultBuilder(args)
|
|
|
|
|
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
2020-08-27 21:36:02 +00:00
|
|
|
|
.UseSerilog()
|
2020-01-26 00:27:45 +00:00
|
|
|
|
.ConfigureWebHostDefaults(whb => whb
|
|
|
|
|
.UseConfiguration(InitUtils.BuildConfiguration(args).Build())
|
2020-08-27 21:35:47 +00:00
|
|
|
|
.ConfigureKestrel(opts =>
|
|
|
|
|
{
|
|
|
|
|
opts.ListenAnyIP(opts.ApplicationServices.GetRequiredService<ApiConfig>().Port);
|
|
|
|
|
})
|
2020-01-26 00:27:45 +00:00
|
|
|
|
.UseStartup<Startup>());
|
2019-07-09 18:39:29 +00:00
|
|
|
|
}
|
|
|
|
|
}
|