Each root namespace (Audit, Common, Data, Environments, Features/Usage, Identities, Organizations, Projects, Segments, Users, Webhooks) gets its own static DependencyRegistration class exposing an Add<Name>Services extension method, so Program.cs just wires them together instead of listing every registration inline.
18 lines
621 B
C#
18 lines
621 B
C#
namespace MicCheck.Api.Webhooks;
|
|
|
|
public static class DependencyRegistration
|
|
{
|
|
public static IServiceCollection AddWebhooksServices(this IServiceCollection services)
|
|
{
|
|
services.AddScoped<WebhookService>();
|
|
services.AddScoped<WebhookDispatcher>();
|
|
services.AddSingleton<WebhookQueue>();
|
|
services.AddHostedService<WebhookBackgroundService>();
|
|
services.AddHostedService<WebhookRetryBackgroundService>();
|
|
services.AddHttpClient("Webhooks", client =>
|
|
client.DefaultRequestHeaders.Add("User-Agent", "MicCheck-Webhook/1.0"));
|
|
|
|
return services;
|
|
}
|
|
}
|