1631786ce2
Add push contracts, provider delivery and channel diagnostics. Link email channels to services and document migration and validation. Ref: IT-1074
38 lines
1.5 KiB
C#
38 lines
1.5 KiB
C#
using HrynCo.NotificationService.DAL.EF;
|
|
using HrynCo.NotificationService.Worker;
|
|
using HrynCo.NotificationService.Worker.Services;
|
|
using Hrynco.RabbitMq;
|
|
|
|
var builder = Host.CreateApplicationBuilder(args);
|
|
|
|
builder.AddSerilog();
|
|
|
|
var appSettings = builder.Configuration
|
|
.GetSection(AppSettings.SectionName)
|
|
.Get<AppSettings>() ?? throw new InvalidOperationException("App settings are not configured.");
|
|
|
|
builder.Services.AddSingleton(appSettings);
|
|
builder.Services.AddNotificationDataAccess(appSettings.ConnectionString);
|
|
builder.Services.AddNotificationWorkerServices();
|
|
|
|
builder.Services.Configure<RabbitMqSettings>(
|
|
builder.Configuration.GetSection($"{AppSettings.SectionName}:RabbitMq"));
|
|
|
|
builder.Services.AddHostedService<SendEmailConsumer>();
|
|
|
|
var pushSettings = builder.Configuration.GetSection("FcmPush")
|
|
.Get<HrynCo.NotificationService.Worker.Services.Push.FcmPushSettings>() ?? new();
|
|
builder.Services.AddSingleton(pushSettings);
|
|
if (pushSettings.Enabled)
|
|
{
|
|
builder.Services.AddScoped<HrynCo.NotificationService.Worker.Services.Push.IFirebasePushClient,
|
|
HrynCo.NotificationService.Worker.Services.Push.FirebasePushClient>();
|
|
builder.Services.AddScoped<HrynCo.NotificationService.Worker.Services.Push.IPushSender,
|
|
HrynCo.NotificationService.Worker.Services.Push.FcmPushSender>();
|
|
builder.Services.AddScoped<HrynCo.NotificationService.Worker.Services.Push.PushDeliveryService>();
|
|
builder.Services.AddHostedService<SendPushConsumer>();
|
|
}
|
|
|
|
var host = builder.Build();
|
|
host.Run();
|