consul fixes

This commit is contained in:
Piotr Biernat 2023-07-29 14:57:36 +02:00
parent 599eaa3712
commit c8beab76f1

View File

@ -9,7 +9,6 @@ import (
"git.pbiernat.dev/egommerce/go-api-pkg/config" "git.pbiernat.dev/egommerce/go-api-pkg/config"
consul "github.com/hashicorp/consul/api" consul "github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/connect" "github.com/hashicorp/consul/connect"
"github.com/hashicorp/go-hclog"
) )
type Service struct { type Service struct {
@ -73,9 +72,7 @@ func (s *Service) Register() error {
Address: s.Address, Address: s.Address,
Port: s.port, Port: s.port,
Tags: s.getTags(), Tags: s.getTags(),
Connect: &consul.AgentServiceConnect{ // Connect: &consul.AgentServiceConnect{Native: true},
Native: true,
},
// Proxy: &consul.AgentServiceConnectProxyConfig{ // Proxy: &consul.AgentServiceConnectProxyConfig{
// DestinationServiceName: s.Name, // DestinationServiceName: s.Name,
// }, // },
@ -118,11 +115,11 @@ func (s *Service) RegisterHealthChecks() {
} }
func (s *Service) Connect() (*connect.Service, error) { func (s *Service) Connect() (*connect.Service, error) {
l := hclog.New(&hclog.LoggerOptions{ // l := hclog.New(&hclog.LoggerOptions{
Name: "consul-registry", // Name: "consul-registry",
Level: hclog.Trace, // Level: hclog.Trace,
}) // })
svc, err := connect.NewServiceWithLogger(s.Name, s.client, l) svc, err := connect.NewService(s.Name, s.client)
s.connect = svc s.connect = svc
cnf := svc.ServerTLSConfig() cnf := svc.ServerTLSConfig()
fmt.Printf("CONNECT SERVER:: %s CONFIG:: %v\n", s.Name, cnf) fmt.Printf("CONNECT SERVER:: %s CONFIG:: %v\n", s.Name, cnf)