Skip to content

Instantly share code, notes, and snippets.

@ivarconr
Created July 15, 2020 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivarconr/d8a932fc9f37f8f525efbe8bdbc36035 to your computer and use it in GitHub Desktop.
Save ivarconr/d8a932fc9f37f8f525efbe8bdbc36035 to your computer and use it in GitHub Desktop.
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using Unleash;
using Unleash.ClientFactory;
namespace hello_net
{
class Program
{
static async Task Main(string[] args)
{
IUnleash unleash = await DemoAsync();
while(true) {
if (unleash.IsEnabled("Demo"))
{
Console.WriteLine("ON");
}
else
{
Console.WriteLine("OFF");
}
await Task.Delay(1000);
}
}
public static async Task<IUnleash> DemoAsync()
{
var settings = new UnleashSettings()
{
AppName = "dot-net-client",
Environment = "local",
UnleashApi = new Uri("https://app.unleash-hosted.com/demo/api/"),
FetchTogglesInterval = TimeSpan.FromSeconds(2),
CustomHttpHeaders = new Dictionary<string, string>()
{
{"Authorization","56907a2fa53c1d16101d509a10b78e36190b0f918d9f122d" }
}
};
var unleashFactory = new UnleashClientFactory();
IUnleash unleash = await unleashFactory.Generate(settings, SynchronousInitialization: true);
return unleash;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment