Skip to content

Commit

Permalink
Use net.SplitHostPort on Consul address
Browse files Browse the repository at this point in the history
Fixes #3267
  • Loading branch information
jefferai committed Aug 31, 2017
1 parent e54a3db commit 706b760
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions physical/consul/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,10 @@ func NewConsulBackend(conf map[string]string, logger log.Logger) (physical.Backe
}

func setupTLSConfig(conf map[string]string) (*tls.Config, error) {
serverName := strings.Split(conf["address"], ":")
serverName, _, err := net.SplitHostPort(conf["address"])
if err != nil {
return nil, err
}

insecureSkipVerify := false
if _, ok := conf["tls_skip_verify"]; ok {
Expand All @@ -262,7 +265,7 @@ func setupTLSConfig(conf map[string]string) (*tls.Config, error) {
tlsClientConfig := &tls.Config{
MinVersion: tlsMinVersion,
InsecureSkipVerify: insecureSkipVerify,
ServerName: serverName[0],
ServerName: serverName,
}

_, okCert := conf["tls_cert_file"]
Expand Down

0 comments on commit 706b760

Please sign in to comment.