consul fixes
This commit is contained in:
parent
71b3f13284
commit
4d1f3644b0
@ -9,6 +9,7 @@ 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 {
|
||||||
@ -74,9 +75,6 @@ func (s *Service) Register() error {
|
|||||||
Tags: s.getTags(),
|
Tags: s.getTags(),
|
||||||
Connect: &consul.AgentServiceConnect{
|
Connect: &consul.AgentServiceConnect{
|
||||||
Native: true,
|
Native: true,
|
||||||
// SidecarService: &consul.AgentServiceRegistration{
|
|
||||||
// Port: s.port,
|
|
||||||
// },
|
|
||||||
},
|
},
|
||||||
// Proxy: &consul.AgentServiceConnectProxyConfig{
|
// Proxy: &consul.AgentServiceConnectProxyConfig{
|
||||||
// DestinationServiceName: s.Name,
|
// DestinationServiceName: s.Name,
|
||||||
@ -120,12 +118,14 @@ func (s *Service) InitHealthChecks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) Connect() (*connect.Service, error) {
|
func (s *Service) Connect() (*connect.Service, error) {
|
||||||
// srvName := s.Name
|
l := hclog.New(&hclog.LoggerOptions{
|
||||||
srvName := s.Name
|
Name: "consul-registry",
|
||||||
svc, err := connect.NewService(srvName, s.client)
|
Level: hclog.Debug,
|
||||||
|
})
|
||||||
|
svc, err := connect.NewServiceWithLogger(s.Name, s.client, l)
|
||||||
s.connect = svc
|
s.connect = svc
|
||||||
cnf := svc.ServerTLSConfig()
|
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 {
|
for k, c := range cnf.Certificates {
|
||||||
fmt.Printf("CONNECT CERT %d: %v", k, c)
|
fmt.Printf("CONNECT CERT %d: %v", k, c)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user