Exemplo n.º 1
0
        /// <summary>
        /// 构建Apollo配置
        /// </summary>
        public static IConfigurationBuilder AddApollo(this IConfigurationBuilder builder, Action <ApolloOptions> optionsConfig)
        {
            var options = new ApolloOptions();

            optionsConfig.Invoke(options);

            return(builder.Add(new ApolloConfigurationSource(options)));
        }
 /// <inheritdoc />
 public ApolloConfigurationProvider(ApolloOptions apolloOptions)
 {
     _apolloOptions = apolloOptions;
     _httpClient    = new HttpClient
     {
         BaseAddress = new Uri(_apolloOptions.MetaServer)
     };
     _namespaceDataKeys      = new ConcurrentDictionary <string, List <string> >();
     _namespaceNotifications = new List <NamespaceNotification>();
 }
Exemplo n.º 3
0
        /// <inheritdoc />
        private static IConfigurationBuilder AddApollo(this IConfigurationBuilder builder, ApolloOptions apolloOptions)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (apolloOptions == null)
            {
                throw new ArgumentException(nameof(apolloOptions));
            }

            return(builder.Add(new ApolloConfigurationSource(apolloOptions)));
        }
Exemplo n.º 4
0
 /// <inheritdoc />
 public ApolloConfigurationSource(ApolloOptions apolloOptions)
 {
     _apolloOptions = apolloOptions;
 }