From e66a2905ab70998e0be0da1651af3e05b0a9d1e5 Mon Sep 17 00:00:00 2001 From: longxboy Date: Fri, 18 Mar 2022 14:58:33 +0800 Subject: [PATCH] feat: supprt non-kratos instance in consul registry (#1892) --- contrib/registry/consul/client.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/registry/consul/client.go b/contrib/registry/consul/client.go index 6b661bd0b..edbc6944d 100644 --- a/contrib/registry/consul/client.go +++ b/contrib/registry/consul/client.go @@ -58,6 +58,9 @@ func defaultResolver(_ context.Context, entries []*api.ServiceEntry) []*registry } endpoints = append(endpoints, addr.Address) } + if len(endpoints) == 0 && entry.Service.Address != "" && entry.Service.Port != 0 { + endpoints = append(endpoints, fmt.Sprintf("http://%s:%d", entry.Service.Address, entry.Service.Port)) + } services = append(services, ®istry.ServiceInstance{ ID: entry.Service.ID, Name: entry.Service.Service,