Files
parr_api/PARR.GeneratorTemplatesWorker/Program.cs

63 lines
1.8 KiB
C#
Raw Normal View History

2023-09-21 15:21:33 +10:00
using PARR.GeneratorTemplates;
2023-09-20 16:51:29 +10:00
using PARR.GeneratorTemplatesWorker;
using Serilog;
2023-09-21 15:21:33 +10:00
var builder = Host.CreateApplicationBuilder();
2023-09-20 16:51:29 +10:00
builder.Services.AddLogging(config =>
{
config.ClearProviders();
var logger = new LoggerConfiguration()
.WriteTo.Console()
.ReadFrom.Configuration(builder.Configuration)
.CreateLogger();
config.AddSerilog(logger);
});
builder.Services.InstallGeneratorTemplateServices(builder.Configuration);
builder.Configuration.AddGeneratorTemplateConfigurations(builder.Services);
builder.Services.AddGeneratorTemplateSettings(builder.Configuration);
builder.Services.AddHostedService<Worker>();
var host = builder.Build();
2023-09-20 16:51:29 +10:00
host.Run();
//IHost host = Host.CreateDefaultBuilder(args)
// .ConfigureServices((hostContext, services) =>
// {
// services.InstallGeneratorTemplateServices(hostContext.Configuration);
// //hostContext.Configuration.AddGeneratorTemplateConfigurations(services);
// //services.AddGeneratorTemplateSettings(hostContext.Configuration);
// //services.AddHostedService<Worker>();
// })
// .ConfigureAppConfiguration((hostContext, configBuilder) =>
// {
// //TODO: !!!!!!!!!не смог прикрутить AddGeneratorTemplateConfigurations, не могу прокинуть туда сервисы
// configBuilder.AddGeneratorTemplateConfigurations(hostContext.Services);
// })
// .ConfigureServices((hostContext, services) =>
// {
// services.AddGeneratorTemplateSettings(hostContext.Configuration);
// services.AddHostedService<Worker>();
// })
// .UseSerilog((hostContext, services, config) =>
// {
// config
// .WriteTo.Console()
// .ReadFrom.Configuration(hostContext.Configuration);
// })
// .Build();
//host.Run();