TWEAK: remove else block in tls handling

This commit is contained in:
taylorchu 2017-01-26 14:03:32 -08:00
parent d00355e8d3
commit fd34c03d47
1 changed files with 6 additions and 15 deletions

View File

@ -1,7 +1,6 @@
package config
import (
"crypto/tls"
"fmt"
"net/http"
"strings"
@ -181,20 +180,12 @@ func (c *ConsulConfig) ApiConfig() (*consul.Config, error) {
tlsConfig.InsecureSkipVerify = !*c.VerifySSL
}
if tlsConfig.InsecureSkipVerify {
config.HttpClient.Transport = &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
}
} else {
tlsClientCfg, err := consul.SetupTLSConfig(&tlsConfig)
if err != nil {
return nil, fmt.Errorf("error creating tls client config for consul: %v", err)
}
config.HttpClient.Transport = &http.Transport{
TLSClientConfig: tlsClientCfg,
}
tlsClientCfg, err := consul.SetupTLSConfig(&tlsConfig)
if err != nil {
return nil, fmt.Errorf("error creating tls client config for consul: %v", err)
}
config.HttpClient.Transport = &http.Transport{
TLSClientConfig: tlsClientCfg,
}
}