/// <summary>
        /// Initializes a new instance of the <see cref="ConfigServerConfigurationProvider"/> class from a <see cref="ConfigServerConfigurationSource"/>
        /// </summary>
        /// <param name="source">the <see cref="ConfigServerConfigurationSource"/> the provider uses when accessing the server.</param>
        public ConfigNacosConfigurationProvider(ConfigNacosConfigurationSource source)
            : this(source.DefaultSettings, source.ClientFactory, source.Processor, source.LogFactory)
        {
            var root = source.Configuration as IConfigurationRoot;

            _configuration = WrapWithPlaceholderResolver(source.Configuration);
            ConfigurationSettingsHelper.Initialize(PREFIX, _settings, _configuration);
        }
        //[Obsolete("Will be removed in next release, use the ConfigServerConfigurationSource")]
        //public virtual IConfigurationProvider Build(IConfigurationBuilder builder)
        //{
        //    ConfigurationBuilder config = new ConfigurationBuilder();
        //    foreach (IConfigurationSource s in builder.Sources)
        //    {
        //        if (s == this)
        //        {
        //            break;
        //        }

        //        config.Add(s);
        //    }

        //    _configuration = WrapWithPlaceholderResolver(config.Build());
        //    ConfigurationSettingsHelper.Initialize(PREFIX, _settings, _configuration);
        //    return this;
        //}

        internal void Load(bool updateDictionary = true)
        {
            // Refresh settings with latest configuration values
            ConfigurationSettingsHelper.Initialize(PREFIX, _settings, _configuration);

            if (!_settings.Enabled)
            {
                _logger?.LogInformation("Config Server client disabled, did not fetch configuration!");
                return;
                //return null;
            }

            //if (IsDiscoveryFirstEnabled())
            //{
            //    var discoveryService = new ConfigServerDiscoveryService(_configuration, _settings, _loggerFactory);
            //    DiscoverServerInstances(discoveryService);
            //}

            // Adds client settings (e.g spring:cloud:config:uri, etc) to the Data dictionary
            AddConfigServerClientSettings();

            //if (_settings.RetryEnabled && _settings.FailFast)
            //{
            //    var attempts = 0;
            //    var backOff = _settings.RetryInitialInterval;
            //    do
            //    {
            //        _logger?.LogInformation("Fetching config from server at: {0}", _settings.Uri);
            //        try
            //        {
            //            return DoLoad(updateDictionary);
            //        }
            //        catch (ConfigNacosException e)
            //        {
            //            _logger?.LogInformation("Failed fetching config from server at: {0}, Exception: {1}", _settings.Uri, e);
            //            attempts++;
            //            if (attempts < _settings.RetryAttempts)
            //            {
            //                Thread.CurrentThread.Join(backOff);
            //                var nextBackoff = (int)(backOff * _settings.RetryMultiplier);
            //                backOff = Math.Min(nextBackoff, _settings.RetryMaxInterval);
            //            }
            //            else
            //            {
            //                throw;
            //            }
            //        }
            //    }
            //    while (true);
            //}
            //else
            //{
            _logger?.LogInformation("Fetching config from server at: {0}", _settings.ServerAddr);
            DoLoad(updateDictionary);
            //return
            //}
        }
        public IConfigurationProvider Build(IConfigurationBuilder builder)
        {
            ConfigurationBuilder config = new ConfigurationBuilder();

            foreach (IConfigurationSource s in builder.Sources)
            {
                if (s == this)
                {
                    break;
                }

                config.Add(s);
            }

            _configuration = WrapWithPlaceholderResolver(config.Build());
            ConfigurationSettingsHelper.Initialize(PREFIX, _settings, _configuration);
            return(this);
        }