From ceaeecf1b42089ae6ddfeb1a449baf67bc41bae4 Mon Sep 17 00:00:00 2001 From: Piotr Biernat Date: Thu, 1 Dec 2022 19:43:35 +0100 Subject: [PATCH] register fix --- consul/discovery.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/consul/discovery.go b/consul/discovery.go index 8097b92..aa57712 100644 --- a/consul/discovery.go +++ b/consul/discovery.go @@ -5,6 +5,7 @@ import ( "log" "net/http" "strconv" + "strings" "time" consul "github.com/hashicorp/consul/api" @@ -58,7 +59,7 @@ func (s *Service) GetFullAddr() string { func (s *Service) Register() error { def := &consul.AgentServiceRegistration{ ID: s.GetID(), - Name: s.Name, + Name: strings.Replace(s.Name, "-", "_", -1), Address: s.IP, Port: s.Port, Tags: s.getTags(),