Skip to content

Commit

Permalink
watch: use CONSUL_TLS_SERVER_NAME for https if defined (#4718)
Browse files Browse the repository at this point in the history
  • Loading branch information
igal-s committed Sep 30, 2018
1 parent f680026 commit 1a257de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ func (a *Agent) reloadWatches(cfg *config.RuntimeConfig) error {

addr := config.Address
if config.Scheme == "https" {
addr = "https://" + addr
addr = "https://" + config.TLSConfig.Address
}

if err := wp.RunWithConfig(addr, config); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion agent/config/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,7 @@ func (c *RuntimeConfig) APIConfig(includeClientCerts bool) (*api.Config, error)
Datacenter: c.Datacenter,
TLSConfig: api.TLSConfig{InsecureSkipVerify: !c.VerifyOutgoing},
}
dcfg := api.DefaultConfig()

unixAddr, httpAddr, httpsAddr := c.ClientAddress()

Expand All @@ -1475,7 +1476,7 @@ func (c *RuntimeConfig) APIConfig(includeClientCerts bool) (*api.Config, error)
cfg.Scheme = "https"
cfg.TLSConfig.CAFile = c.CAFile
cfg.TLSConfig.CAPath = c.CAPath
cfg.TLSConfig.Address = httpsAddr
cfg.TLSConfig.Address = dcfg.TLSConfig.Address
if includeClientCerts {
cfg.TLSConfig.CertFile = c.CertFile
cfg.TLSConfig.KeyFile = c.KeyFile
Expand Down

0 comments on commit 1a257de

Please sign in to comment.