Compare commits

...

5 Commits

Author SHA1 Message Date
5bf58aad16 register fix 2022-12-01 20:26:22 +01:00
ba6bd4137c register fix 2022-12-01 20:19:28 +01:00
48a7e968d1 register fix 2022-12-01 19:54:59 +01:00
6c46a0e6a4 register fix 2022-12-01 19:45:47 +01:00
ceaeecf1b4 register fix 2022-12-01 19:43:35 +01:00

View File

@@ -5,6 +5,7 @@ import (
"log" "log"
"net/http" "net/http"
"strconv" "strconv"
"strings"
"time" "time"
consul "github.com/hashicorp/consul/api" consul "github.com/hashicorp/consul/api"
@@ -25,7 +26,7 @@ var ErrServiceUnavailable = fmt.Errorf("Service is unavailable")
func NewService(serverAddr, appID, appName, ip, domain string, appPort int) (*Service, error) { func NewService(serverAddr, appID, appName, ip, domain string, appPort int) (*Service, error) {
s := new(Service) s := new(Service)
s.AppID = appID s.AppID = appID
s.Name = appName s.Name = strings.Replace(appName, "-", "", -1)
s.Address = domain s.Address = domain
s.IP = ip s.IP = ip
s.Port = appPort s.Port = appPort
@@ -119,7 +120,10 @@ func (s *Service) check() (bool, error) {
func (s *Service) getMetadata() map[string]string { func (s *Service) getMetadata() map[string]string {
m := map[string]string{} m := map[string]string{}
m["traefik/http/services/"+s.Name+"/loadBalancer/servers/0/url"] = s.GetFullAddr() key := fmt.Sprintf("traefik/http/services/%s/loadBalancer/servers/0/url", s.Name)
m[key] = s.GetFullAddr()
fmt.Printf("netadata: %v", m)
return m return m
} }