Trying and find a package from API
parent
06b0115405
commit
9e79edc624
@ -1,8 +0,0 @@
|
|||||||
namespace isnd.Entities
|
|
||||||
{
|
|
||||||
public class UnleashClientSettings
|
|
||||||
{
|
|
||||||
public string ClientApiKey { get; set; }
|
|
||||||
public string ApiUrl { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +1,9 @@
|
|||||||
using Unleash;
|
|
||||||
|
|
||||||
namespace isnd.ViewModels
|
namespace isnd.ViewModels
|
||||||
{
|
{
|
||||||
public class HomeIndexViewModel
|
public class HomeIndexViewModel
|
||||||
{
|
{
|
||||||
public int PkgCount { get; set; }
|
public int PkgCount { get; set; }
|
||||||
public IUnleash UnleashClient;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,17 +1 @@
|
|||||||
@model HomeIndexViewModel
|
@model HomeIndexViewModel
|
||||||
@{
|
|
||||||
foreach (string leashed in new string[] { "pkg-push", "pkg-get",
|
|
||||||
"pkg-autocomplete","pkg-search","pkg-catalog"})
|
|
||||||
{
|
|
||||||
if (Model.UnleashClient.IsEnabled(leashed))
|
|
||||||
{
|
|
||||||
//do some magic
|
|
||||||
<p>@leashed</p>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//do old boring stuff
|
|
||||||
<p>No @leashed (disabled)</p>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue