Split Program.cs DI registrations into per-namespace DependencyRegistration classes
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.
This commit is contained in:
17
src/api/MicCheck.Api/Webhooks/DependencyRegistration.cs
Normal file
17
src/api/MicCheck.Api/Webhooks/DependencyRegistration.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user