public static IConfigurationBuilder AddRemoteConfig( this IConfigurationBuilder configurationBuilder, Action <RemoteConfigOptions> options) { _ = options ?? throw new ArgumentNullException(nameof(options)); var configOptions = new RemoteConfigOptions(); options(configOptions); return(configurationBuilder.Add(new RemoteConfigConfigurationSource(configOptions))); }
public RemoteConfigConfigurationProvider( RemoteConfigConfigurationSource source, RemoteConfigOptions remoteConfigOptions) : base(source) { this.remoteConfigOptions = remoteConfigOptions; this.http = new HttpClient(); if (remoteConfigOptions.AuthorizationBearer != null) { http.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", $"Bearer {remoteConfigOptions.AuthorizationBearer}"); } updateTsk = Task.Run(async() => { while (true) { await PollRemoteConfig(); await Task.Delay(remoteConfigOptions.PollingInterval); } }); }
public RemoteConfigConfigurationSource(RemoteConfigOptions remoteConfigOptions) : base() { this.remoteConfigOptions = remoteConfigOptions; }