Unleash client instance as singleton
This commit is contained in:
parent
a345992351
commit
cd7c0be03d
3 changed files with 14 additions and 7 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue