public ConsulConfigurationProvider(IConsulConfigurationSource source, IConsulConfigurationClient consulConfigClient, string serviceKey) { this.consulConfigClient = consulConfigClient; this.source = source; this.serviceKey = serviceKey; if (source.ReloadOnChange) { ChangeToken.OnChange( () => this.consulConfigClient.Watch(this.source.Key, this.source.CancellationToken), async() => { await this.DoLoad(true).ConfigureAwait(false); this.OnReload(); }); } }
public ConsulConfigurationProvider(IConsulConfigurationSource source, IConsulConfigurationClient consulConfigClient) { if (source.Parser == null) { throw new ArgumentNullException(nameof(source.Parser)); } _consulConfigClient = consulConfigClient; _source = source; if (source.ReloadOnChange) { ChangeToken.OnChange( () => _consulConfigClient.Watch(_source.OnWatchException), async() => { await DoLoad(reloading: true); OnReload(); }); } }