From 3b73091cfb1c330f33241dc2f59752f5c22c2c3c Mon Sep 17 00:00:00 2001 From: Piotr Biernat Date: Sat, 29 Jul 2023 15:11:22 +0200 Subject: [PATCH] consul fixes --- consul/discovery.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/consul/discovery.go b/consul/discovery.go index 42e4dcb..6cbb5ac 100644 --- a/consul/discovery.go +++ b/consul/discovery.go @@ -61,7 +61,12 @@ func (s *Service) GetID() string { } func (s *Service) GetFullAddr() string { - return fmt.Sprintf("https://%s:%d/", s.domain, s.port) + isTLS := s.port == 443 + proto := "http" + if isTLS { + proto = "https" + } + return fmt.Sprintf("%s://%s:%d/", proto, s.domain, s.port) } func (s *Service) Register() error {