20 lines
622 B
C#
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;
|
|
}
|
|
}
|