Compare commits

...

7 Commits

Author SHA1 Message Date
3b73091cfb consul fixes 2023-07-29 15:11:22 +02:00
c8beab76f1 consul fixes 2023-07-29 14:57:36 +02:00
599eaa3712 consul fixes 2023-07-29 13:47:51 +02:00
1de38fdfdf consul fixes 2023-07-26 23:19:17 +02:00
4d1f3644b0 consul fixes 2023-07-26 23:14:25 +02:00
71b3f13284 consul fixes 2023-07-08 17:18:19 +02:00
c64bc3fe6b consul fixes 2023-07-08 17:16:53 +02:00

View File

@@ -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 {
@@ -72,12 +77,7 @@ func (s *Service) Register() error {
Address: s.Address,
Port: s.port,
Tags: s.getTags(),
Connect: &consul.AgentServiceConnect{
Native: true,
// SidecarService: &consul.AgentServiceRegistration{
// Port: s.port,
// },
},
// Connect: &consul.AgentServiceConnect{Native: true},
// Proxy: &consul.AgentServiceConnectProxyConfig{
// DestinationServiceName: s.Name,
// },
@@ -98,7 +98,7 @@ func (s *Service) Unregister() error {
return s.agent.ServiceDeregister(s.GetID())
}
func (s *Service) InitTTL() {
func (s *Service) RegisterHealthChecks() {
go func() { // startup register
ticker := time.NewTicker(time.Second * 1)
for range ticker.C {
@@ -120,12 +120,14 @@ func (s *Service) InitTTL() {
}
func (s *Service) Connect() (*connect.Service, error) {
// srvName := s.Name
srvName := s.Name
svc, err := connect.NewService(srvName, s.client)
// l := hclog.New(&hclog.LoggerOptions{
// Name: "consul-registry",
// Level: hclog.Trace,
// })
svc, err := connect.NewService(s.Name, s.client)
s.connect = svc
cnf := svc.ServerTLSConfig()
fmt.Printf("CONNECT SERVER:: %s CONFIG:: %v\n", srvName, cnf)
fmt.Printf("CONNECT SERVER:: %s CONFIG:: %v\n", s.Name, cnf)
for k, c := range cnf.Certificates {
fmt.Printf("CONNECT CERT %d: %v", k, c)
}