public static void Initialize(string configPrefix, ConfigServerClientSettings settings, IConfiguration config)
        {
            if (configPrefix == null)
            {
                throw new ArgumentNullException(nameof(configPrefix));
            }

            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            var clientConfigsection = config.GetSection(configPrefix);

            settings.Name                 = GetApplicationName(clientConfigsection, config, settings.Name);
            settings.Environment          = config.GetValue <string>("mode");
            settings.Label                = GetLabel(clientConfigsection, config);
            settings.Username             = GetUsername(clientConfigsection, config);
            settings.Password             = GetPassword(clientConfigsection, config);
            settings.Uri                  = GetUri(clientConfigsection, config, settings.Uri);
            settings.Enabled              = GetEnabled(clientConfigsection, config, settings.Enabled);
            settings.FailFast             = GetFailFast(clientConfigsection, config, settings.FailFast);
            settings.ValidateCertificates = GetCertificateValidation(clientConfigsection, config, settings.ValidateCertificates);
            settings.RetryEnabled         = GetRetryEnabled(clientConfigsection, config, settings.RetryEnabled);
            settings.RetryInitialInterval = GetRetryInitialInterval(clientConfigsection, config, settings.RetryInitialInterval);
            settings.RetryMaxInterval     = GetRetryMaxInterval(clientConfigsection, config, settings.RetryMaxInterval);
            settings.RetryMultiplier      = GetRetryMultiplier(clientConfigsection, config, settings.RetryMultiplier);
            settings.RetryAttempts        = GetRetryMaxAttempts(clientConfigsection, config, settings.RetryAttempts);
            settings.Token                = GetToken(clientConfigsection, config);
            settings.Timeout              = GetTimeout(clientConfigsection, config, settings.Timeout);
            settings.RefreshEnable        = GetConfigValue("refreshEnable", clientConfigsection, config, false);
            settings.RefreshInterval      =
                GetConfigValue("refreshInterval", clientConfigsection, config, settings.RefreshInterval);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigServerConfigurationProvider"/> class.
 /// </summary>
 /// <param name="settings">the configuration settings the provider uses when accessing the server.</param>
 public ConfigServerConfigurationProvider(ConfigServerClientSettings settings)
 {
     Logger    = LogManager.Logger <ConfigServerConfigurationProvider>();
     _settings = settings ?? throw new ArgumentNullException(nameof(settings));
     _client   = null;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigServerConfigurationProvider"/> class.
 /// </summary>
 /// <param name="settings">the configuration settings the provider uses when accessing the server.</param>
 /// <param name="httpClient">a HttpClient the provider uses to make requests of the server.</param>
 public ConfigServerConfigurationProvider(ConfigServerClientSettings settings, HttpClient httpClient)
 {
     _settings = settings ?? throw new ArgumentNullException(nameof(settings));
     _client   = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
     Logger    = LogManager.Logger <ConfigServerConfigurationProvider>();
 }
 /// <summary>
 /// Creates an appropriatly configured HttpClient that will be used in communicating with the
 /// Spring Cloud Configuration Server
 /// </summary>
 /// <param name="settings">the settings used in configuring the HttpClient</param>
 /// <returns>The HttpClient used by the provider</returns>
 protected static HttpClient GetHttpClient(ConfigServerClientSettings settings)
 {
     return(HttpClientHelper.GetHttpClient(settings.ValidateCertificates, settings.Timeout));
 }