Unleash client instance as singleton
This commit is contained in:
@ -19,6 +19,7 @@ using System;
|
||||
using Unleash.ClientFactory;
|
||||
using isnd.Entities;
|
||||
using Microsoft.Extensions.Options;
|
||||
using isnd.Helpers;
|
||||
|
||||
namespace isn
|
||||
{
|
||||
@ -64,7 +65,13 @@ namespace isn
|
||||
});
|
||||
|
||||
services.AddSingleton<IAuthorizationHandler, ValidApiKeyRequirementHandler>();
|
||||
|
||||
services.AddSingleton<IUnleash>(s =>
|
||||
{
|
||||
var config = s.GetRequiredService<IOptions<UnleashClientSettings>>();
|
||||
return s.GetRequiredService<Microsoft.AspNetCore.Hosting.IHostingEnvironment>().CreateUnleahClient(config.Value);
|
||||
});
|
||||
|
||||
// _unleashĈlient = env.CreateUnleahClient(unleashClientSettings.Value);
|
||||
var smtpSettingsconf = Configuration.GetSection("Smtp");
|
||||
services.Configure<SmtpSettings>(smtpSettingsconf);
|
||||
var nugetSettingsconf = Configuration.GetSection("Nuget");
|
||||
|
Reference in New Issue
Block a user