From cb3989a7142898e1a562a93a348a434a11a1f380 Mon Sep 17 00:00:00 2001 From: Thiago Loureiro Date: Tue, 19 Mar 2019 23:26:50 +0100 Subject: [PATCH] =?UTF-8?q?Revert=20"Fix=20bug=EF=BC=9A=20(#810)"=20(#823)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 19c80afb05290fac3a144f652cd663c8b513a559. --- src/Ocelot.Provider.Consul/Consul.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Ocelot.Provider.Consul/Consul.cs b/src/Ocelot.Provider.Consul/Consul.cs index a060f2f6..b202cd57 100644 --- a/src/Ocelot.Provider.Consul/Consul.cs +++ b/src/Ocelot.Provider.Consul/Consul.cs @@ -27,7 +27,7 @@ public async Task> Get() { - var queryResult = await _consul.Catalog.Service(_config.KeyOfServiceInConsul, string.Empty); + var queryResult = await _consul.Health.Service(_config.KeyOfServiceInConsul, string.Empty, true); var services = new List(); @@ -39,26 +39,26 @@ } else { - _logger.LogWarning($"Unable to use service Address: {serviceEntry.Address} and Port: {serviceEntry.ServicePort} as it is invalid. Address must contain host only e.g. localhost and port must be greater than 0"); + _logger.LogWarning($"Unable to use service Address: {serviceEntry.Service.Address} and Port: {serviceEntry.Service.Port} as it is invalid. Address must contain host only e.g. localhost and port must be greater than 0"); } } return services.ToList(); } - private Service BuildService(CatalogService serviceEntry) + private Service BuildService(ServiceEntry serviceEntry) { return new Service( - serviceEntry.ServiceName, - new ServiceHostAndPort(serviceEntry.Address, serviceEntry.ServicePort), - serviceEntry.ServiceID, - GetVersionFromStrings(serviceEntry.ServiceTags), - serviceEntry.ServiceTags ?? Enumerable.Empty()); + serviceEntry.Service.Service, + new ServiceHostAndPort(serviceEntry.Service.Address, serviceEntry.Service.Port), + serviceEntry.Service.ID, + GetVersionFromStrings(serviceEntry.Service.Tags), + serviceEntry.Service.Tags ?? Enumerable.Empty()); } - private bool IsValid(CatalogService serviceEntry) + private bool IsValid(ServiceEntry serviceEntry) { - if (string.IsNullOrEmpty(serviceEntry.Address) || serviceEntry.Address.Contains("http://") || serviceEntry.Address.Contains("https://") || serviceEntry.ServicePort <= 0) + if (string.IsNullOrEmpty(serviceEntry.Service.Address) || serviceEntry.Service.Address.Contains("http://") || serviceEntry.Service.Address.Contains("https://") || serviceEntry.Service.Port <= 0) { return false; }