Unleash client init
parent
d33a19d35f
commit
355b2d4c7c
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using isnd.Entities;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Unleash;
|
||||
using Unleash.ClientFactory;
|
||||
|
||||
namespace isnd.Helpers
|
||||
{
|
||||
public static class UnleashHelpers
|
||||
{
|
||||
|
||||
public static IUnleash CreateUnleahClient(this IHostingEnvironment env,
|
||||
UnleashClientSettings unleashClientSettings)
|
||||
{
|
||||
var unleashSettings = new UnleashSettings
|
||||
{
|
||||
UnleashApi = new Uri(unleashClientSettings.ApiUrl),
|
||||
AppName = "isnd",
|
||||
Environment = env.EnvironmentName,
|
||||
CustomHttpHeaders = new Dictionary<string, string>
|
||||
{
|
||||
{ "Authorization", unleashClientSettings.ClientApiKey }
|
||||
}
|
||||
};
|
||||
|
||||
UnleashClientFactory unleashClientFactory = new UnleashClientFactory();
|
||||
return unleashClientFactory.CreateClient(unleashSettings);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue