Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 599eaa3712 | |||
| 1de38fdfdf | |||
| 4d1f3644b0 | |||
| 71b3f13284 |
@@ -9,6 +9,7 @@ import (
|
||||
"git.pbiernat.dev/egommerce/go-api-pkg/config"
|
||||
consul "github.com/hashicorp/consul/api"
|
||||
"github.com/hashicorp/consul/connect"
|
||||
"github.com/hashicorp/go-hclog"
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
@@ -74,9 +75,6 @@ func (s *Service) Register() error {
|
||||
Tags: s.getTags(),
|
||||
Connect: &consul.AgentServiceConnect{
|
||||
Native: true,
|
||||
// SidecarService: &consul.AgentServiceRegistration{
|
||||
// Port: s.port,
|
||||
// },
|
||||
},
|
||||
// Proxy: &consul.AgentServiceConnectProxyConfig{
|
||||
// DestinationServiceName: s.Name,
|
||||
@@ -98,7 +96,7 @@ func (s *Service) Unregister() error {
|
||||
return s.agent.ServiceDeregister(s.GetID())
|
||||
}
|
||||
|
||||
func (s *Service) InitCheclChecks() {
|
||||
func (s *Service) RegisterHealthChecks() {
|
||||
go func() { // startup register
|
||||
ticker := time.NewTicker(time.Second * 1)
|
||||
for range ticker.C {
|
||||
@@ -120,12 +118,14 @@ func (s *Service) InitCheclChecks() {
|
||||
}
|
||||
|
||||
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.NewServiceWithLogger(s.Name, s.client, l)
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user