public Etcd(EtcdRegistryConfiguration config, IOcelotLoggerFactory factory, IEtcdClientFactory clientFactory) { logger = factory.CreateLogger <Etcd>(); this.config = config; this.etcdClientFactory = clientFactory; Services = new List <Service>(); }
public EtcdFileConfigurationRepository( Cache.IOcelotCache <FileConfiguration> cache, IInternalConfigurationRepository repo, IEtcdClientFactory factory, IOcelotLoggerFactory loggerFactory) { _logger = loggerFactory.CreateLogger <EtcdFileConfigurationRepository>(); _cache = cache; var internalConfig = repo.Get(); _configurationKey = "InternalConfiguration"; string token = null; if (!internalConfig.IsError) { token = internalConfig.Data.ServiceProviderConfiguration.Token; _configurationKey = !string.IsNullOrEmpty(internalConfig.Data.ServiceProviderConfiguration.ConfigurationKey) ? internalConfig.Data.ServiceProviderConfiguration.ConfigurationKey : _configurationKey; } var config = new EtcdRegistryConfiguration( internalConfig.Data.ServiceProviderConfiguration.Host, internalConfig.Data.ServiceProviderConfiguration.Port, _configurationKey); _etcdClient = factory.Get(config); }
public EtcdClient Get(EtcdRegistryConfiguration config) { if (config.Host != this.host || config.Port != this.port) { this.host = config.Host; this.port = config.Port; this.client = new EtcdClient(config.Host, config.Port); } return(client.GetEtcdClient().GetClient()); }