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>
|
/// <summary>
|
||||||
/// Adds Infrastructure layer services to the DI container
|
/// Adds Infrastructure layer services to the DI container
|
||||||
/// </summary>
|
/// </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();
|
services.AddDefaultServices();
|
||||||
|
|
||||||
// --- RabbitMQ Configuration ---
|
// --- RabbitMQ Configuration ---
|
||||||
services.Configure<RabbitMqConfiguration>(
|
services.Configure<RabbitMqConfiguration>(configuration.GetSection(sectionName));
|
||||||
configuration.GetSection(RabbitMqConfiguration.SectionName));
|
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user