Ejemplo n.º 1
0
 public static IJsonClientProvider GetProvider(IJsonFlagSerializer serializer, string path)
 {
     if (path.Contains("http"))
     {
         return(new JsonHttpClientProvider(serializer, path));
     }
     else
     {
         return(new JsonFileClientProvider(serializer, path));
     }
 }
Ejemplo n.º 2
0
        public JsonTogglerClient(IJsonFlagSerializer serializer, string path)
        {
            jsonClientProvider = JsonClientProviderFactory.GetProvider(serializer, path);

            toggleCollection = new ThreadSafeToggleCollection()
            {
                Instance = jsonClientProvider.FetchToggles().Result.ToggleCollection
            };

            var fetchFeatureTogglesTask = new FetchFeatureTogglesTask(jsonClientProvider, toggleCollection);

            Task statisticsUploader = PeriodicAsync(async() =>
            {
                try
                {
                    await fetchFeatureTogglesTask.ExecuteAsync();
                }
                catch (Exception ex)
                {
                    // Log the exception
                }
            }, TimeSpan.FromSeconds(10));
        }
Ejemplo n.º 3
0
 public JsonFileClientProvider(IJsonFlagSerializer serializer, string filePath)
 {
     this.serializer = serializer;
     this.filePath   = filePath;
 }
 public JsonHttpClientProvider(IJsonFlagSerializer serializer, string url, HttpClient client)
 {
     this.serializer = serializer;
     this.url        = url;
     httpClient      = client;
 }
 public JsonHttpClientProvider(IJsonFlagSerializer serializer, string url) : this(serializer, url, new HttpClient())
 {
 }
 public JsonFlagSerializerTests()
 {
     serializer = new JsonFlagSerializer();
 }