This commit is contained in:
2021-11-29 00:38:55 +01:00
parent 73700ab1e3
commit 192a0d795a
22 changed files with 304 additions and 114 deletions
@@ -8,13 +8,14 @@ internal static class ServiceCollectionExtensions
{
public static IServiceCollection AddZeroConfiguration(this IServiceCollection services, IConfiguration config)
{
services.AddOptions<ZeroOptions>().Bind(config.GetSection("Zero")).Configure(opts =>
services.AddOptions<ZeroOptions>().Configure<IServiceProvider>((opts, svc) =>
{
opts.ServiceProvider = svc;
opts.Version = "0.0.1-alpha.1";
opts.ZeroPath = "/zero";
opts.TokenExpiration = TimeSpan.FromHours(3);
});
services.AddTransient<IZeroOptions>(factory => factory.GetService<IOptionsMonitor<ZeroOptions>>().CurrentValue);
opts.TokenExpiration = TimeSpan.FromHours(3);
}).Bind(config.GetSection("Zero"));
services.AddTransient<IZeroOptions, ZeroOptions>(factory => factory.GetService<IOptions<ZeroOptions>>().Value);
services.AddOptions<FeatureOptions>().Bind(config.GetSection("Zero:Features"));