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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user