Beispiel #1
0
 public ObservableConsul(IConsulClient client, TimeSpan?longPollMaxWait = null, TimeSpan?retryDelay = null, string aclToken = null)
 {
     _client        = client;
     _configuration = new ObservableConsulConfiguration
     {
         AclToken        = aclToken,
         LongPollMaxWait = longPollMaxWait,
         RetryDelay      = retryDelay
     };
 }
Beispiel #2
0
        public ObservableConsul(ObservableConsulConfiguration config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            _configuration = config;

            _client = new ConsulClient(c =>
            {
                if (!string.IsNullOrEmpty(config.Endpoint))
                {
                    c.Address = new Uri(config.Endpoint);
                }
                if (!string.IsNullOrEmpty(config.Datacenter))
                {
                    c.Datacenter = config.Datacenter;
                }
            });
        }
Beispiel #3
0
        public ObservableConsul(ObservableConsulConfiguration config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            _client = new ConsulClient(c =>
            {
                if (!string.IsNullOrEmpty(config.Endpoint))
                {
                    c.Address = new Uri(config.Endpoint);
                }
                if (!string.IsNullOrEmpty(config.Datacenter))
                {
                    c.Datacenter = config.Datacenter;
                }
            });
            _longPollMaxWait = config.LongPollMaxWait;
            _retryDelay      = config.RetryDelay;
            _aclToken        = config.AclToken;
        }