Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 398d7a2074 | |||
| b699008fa3 | |||
| b1f04badd5 | |||
| f0b5e56e43 | |||
| c644f42ea9 |
@@ -3,7 +3,6 @@ package config
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/gofiber/fiber/v2/log"
|
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -16,7 +15,7 @@ func init() {
|
|||||||
func GetEnv(name string, defVal string) string {
|
func GetEnv(name string, defVal string) string {
|
||||||
env := os.Getenv(name)
|
env := os.Getenv(name)
|
||||||
if env == "" {
|
if env == "" {
|
||||||
log.Panicf("Missing %s env variable", name)
|
return defVal
|
||||||
}
|
}
|
||||||
|
|
||||||
return env
|
return env
|
||||||
|
|||||||
@@ -95,6 +95,11 @@ func (s *Service) Register() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (s *Service) Unregister() error {
|
func (s *Service) Unregister() error {
|
||||||
|
// s.client.Catalog().Deregister(&consul.CatalogDeregistration{
|
||||||
|
// Address: s.Address,
|
||||||
|
// ServiceID: s.GetID(),
|
||||||
|
// }, nil)
|
||||||
|
|
||||||
return s.agent.ServiceDeregister(s.GetID())
|
return s.agent.ServiceDeregister(s.GetID())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,6 +199,9 @@ func (s *Service) getTags() []string {
|
|||||||
"traefik.http.services." + s.Name + ".loadbalancer.server.scheme=http",
|
"traefik.http.services." + s.Name + ".loadbalancer.server.scheme=http",
|
||||||
"traefik.http.services." + s.Name + ".loadbalancer.server.port=" + strconv.Itoa(s.port),
|
"traefik.http.services." + s.Name + ".loadbalancer.server.port=" + strconv.Itoa(s.port),
|
||||||
"traefik.http.services." + s.Name + ".loadbalancer.passhostheader=true",
|
"traefik.http.services." + s.Name + ".loadbalancer.passhostheader=true",
|
||||||
|
"traefik.http.services." + s.Name + ".loadbalancer.healthcheck.interval=1s",
|
||||||
|
"traefik.http.services." + s.Name + ".loadbalancer.healthcheck.timeout=1s",
|
||||||
|
"traefik.http.services." + s.Name + ".loadbalancer.healthcheck.path=/health",
|
||||||
"traefik.tls.certificates.certfile=/certs/client.cert",
|
"traefik.tls.certificates.certfile=/certs/client.cert",
|
||||||
"traefik.tls.certificates.keyfile=/certs/client.key",
|
"traefik.tls.certificates.keyfile=/certs/client.key",
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user