Files
mxaccessgw/src/MxGateway.Server/Configuration/GatewayConfigurationServiceCollectionExtensions.cs
T
2026-04-26 16:11:30 -04:00

20 lines
622 B
C#

using Microsoft.Extensions.Options;
namespace MxGateway.Server.Configuration;
public static class GatewayConfigurationServiceCollectionExtensions
{
public static IServiceCollection AddGatewayConfiguration(this IServiceCollection services)
{
services
.AddOptions<GatewayOptions>()
.BindConfiguration(GatewayOptions.SectionName)
.ValidateOnStart();
services.AddSingleton<IValidateOptions<GatewayOptions>, GatewayOptionsValidator>();
services.AddSingleton<IGatewayConfigurationProvider, GatewayConfigurationProvider>();
return services;
}
}