Esempio n. 1
0
        public ConsulRegistryHost(ConsulRegistryHostConfiguration configuration = null)
        {
            _configuration = configuration;

            _consul = new ConsulClient(config =>
            {
                config.Address = new Uri(_configuration.HttpEndpoint);
                if (!string.IsNullOrEmpty(_configuration.Datacenter))
                {
                    config.Datacenter = _configuration.Datacenter;
                }
            });
        }
Esempio n. 2
0
        public ConsulRegistryHost(ConsulRegistryHostConfiguration configuration = null)
        {
            string consulHost = configuration?.HostName ?? "localhost";
            int    consulPort = configuration?.Port ?? 8500;

            _configuration = new ConsulRegistryHostConfiguration {
                HostName = consulHost, Port = consulPort
            };

            _consul = new ConsulClient(config =>
            {
                config.Address = new Uri($"http://{_configuration.HostName}:{_configuration.Port}");
            });
        }