Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a4f4b6e059 | |||
| 5bf58aad16 | |||
| ba6bd4137c | |||
| 48a7e968d1 | |||
| 6c46a0e6a4 |
@@ -26,7 +26,7 @@ var ErrServiceUnavailable = fmt.Errorf("Service is unavailable")
|
||||
func NewService(serverAddr, appID, appName, ip, domain string, appPort int) (*Service, error) {
|
||||
s := new(Service)
|
||||
s.AppID = appID
|
||||
s.Name = appName
|
||||
s.Name = strings.Replace(appName, "-", "", -1)
|
||||
s.Address = domain
|
||||
s.IP = ip
|
||||
s.Port = appPort
|
||||
@@ -59,7 +59,7 @@ func (s *Service) GetFullAddr() string {
|
||||
func (s *Service) Register() error {
|
||||
def := &consul.AgentServiceRegistration{
|
||||
ID: s.GetID(),
|
||||
Name: strings.Replace(s.Name, "-", "_", -1),
|
||||
Name: s.Name,
|
||||
Address: s.IP,
|
||||
Port: s.Port,
|
||||
Tags: s.getTags(),
|
||||
@@ -120,7 +120,10 @@ func (s *Service) check() (bool, error) {
|
||||
|
||||
func (s *Service) getMetadata() 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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user