in src/Microsoft.Extensions.Configuration.AzureAppConfiguration/AzureAppConfigurationProvider.cs [109:154]
public AzureAppConfigurationProvider(IConfigurationClientManager configClientManager, AzureAppConfigurationOptions options, bool optional)
{
_configClientManager = configClientManager ?? throw new ArgumentNullException(nameof(configClientManager));
_options = options ?? throw new ArgumentNullException(nameof(options));
_optional = optional;
IEnumerable<KeyValueWatcher> watchers = options.IndividualKvWatchers.Union(options.FeatureFlagWatchers);
bool hasWatchers = watchers.Any();
TimeSpan minWatcherRefreshInterval = hasWatchers ? watchers.Min(w => w.RefreshInterval) : TimeSpan.MaxValue;
if (options.RegisterAllEnabled)
{
if (options.KvCollectionRefreshInterval <= TimeSpan.Zero)
{
throw new ArgumentException(
$"{nameof(options.KvCollectionRefreshInterval)} must be greater than zero seconds when using RegisterAll for refresh",
nameof(options));
}
MinRefreshInterval = TimeSpan.FromTicks(Math.Min(minWatcherRefreshInterval.Ticks, options.KvCollectionRefreshInterval.Ticks));
}
else if (hasWatchers)
{
MinRefreshInterval = minWatcherRefreshInterval;
}
else
{
MinRefreshInterval = RefreshConstants.DefaultRefreshInterval;
}
// Enable request tracing if not opt-out
string requestTracingDisabled = null;
try
{
requestTracingDisabled = Environment.GetEnvironmentVariable(RequestTracingConstants.RequestTracingDisabledEnvironmentVariable);
}
catch (SecurityException) { }
_requestTracingEnabled = bool.TryParse(requestTracingDisabled, out bool tracingDisabled) ? !tracingDisabled : true;
if (_requestTracingEnabled)
{
SetRequestTracingOptions();
}
}