2023-09-27 11:47:04 +10:00
|
|
|
using Elastic.CommonSchema.Serilog;
|
2023-08-25 15:32:06 +10:00
|
|
|
using PARR.EsppTemplateSync;
|
|
|
|
|
using PARR.EsppTemplateSyncWorker;
|
|
|
|
|
using Serilog;
|
|
|
|
|
|
|
|
|
|
IHost host = Host.CreateDefaultBuilder(args)
|
|
|
|
|
.ConfigureServices((hostContext, services) =>
|
|
|
|
|
{
|
|
|
|
|
services.InstallEsppTemplateSyncServices(hostContext.Configuration);
|
|
|
|
|
|
|
|
|
|
services.AddHostedService<Worker>();
|
|
|
|
|
})
|
|
|
|
|
.UseSerilog((hostContext, services, config) =>
|
|
|
|
|
{
|
2023-09-27 11:47:04 +10:00
|
|
|
if (hostContext.HostingEnvironment.IsProduction())
|
|
|
|
|
config.WriteTo.Console(new EcsTextFormatter());
|
|
|
|
|
else
|
|
|
|
|
config.WriteTo.Console();
|
|
|
|
|
|
|
|
|
|
config.ReadFrom.Configuration(hostContext.Configuration);
|
2023-08-25 15:32:06 +10:00
|
|
|
})
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
host.Run();
|