feat(rabbitmq): add optional sectionName param to AddRabbitMqConnectionFactory

Allow callers to bind RabbitMQ config from a non-default section name.
Defaults to RabbitMqConfiguration.SectionName to keep existing callers working.
This commit is contained in:
2026-11-02 15:01:46 +01:00
parent 9bd100c0c5
commit 51732fa9fc

View File

@@ -31,13 +31,12 @@ namespace DigitalData.MessagingService.RabbitMQ
/// <summary>
/// Adds Infrastructure layer services to the DI container
/// </summary>
public static IServiceCollection AddRabbitMqConnectionFactory(this IServiceCollection services, IConfiguration configuration)
public static IServiceCollection AddRabbitMqConnectionFactory(this IServiceCollection services, IConfiguration configuration, string sectionName = RabbitMqConfiguration.SectionName)
{
services.AddDefaultServices();
// --- RabbitMQ Configuration ---
services.Configure<RabbitMqConfiguration>(
configuration.GetSection(RabbitMqConfiguration.SectionName));
services.Configure<RabbitMqConfiguration>(configuration.GetSection(sectionName));
return services;
}