diff --git a/consul/consul.go b/consul/consul.go index 5c1d094f6..73d814de5 100644 --- a/consul/consul.go +++ b/consul/consul.go @@ -4,9 +4,10 @@ import ( "fmt" "log" "net/url" - "strings" - "strconv" "os" + "strconv" + "strings" + "github.com/gliderlabs/registrator/bridge" consulapi "github.com/hashicorp/consul/api" "github.com/hashicorp/go-cleanhttp" @@ -34,21 +35,21 @@ func (f *Factory) New(uri *url.URL) bridge.RegistryAdapter { if uri.Scheme == "consul-unix" { config.Address = strings.TrimPrefix(uri.String(), "consul-") } else if uri.Scheme == "consul-tls" { - tlsConfigDesc := &consulapi.TLSConfig { - Address: uri.Host, - CAFile: os.Getenv("CONSUL_CACERT"), - CertFile: os.Getenv("CONSUL_TLSCERT"), - KeyFile: os.Getenv("CONSUL_TLSKEY"), - InsecureSkipVerify: false, + tlsConfigDesc := &consulapi.TLSConfig{ + Address: uri.Host, + CAFile: os.Getenv("CONSUL_CACERT"), + CertFile: os.Getenv("CONSUL_TLSCERT"), + KeyFile: os.Getenv("CONSUL_TLSKEY"), + InsecureSkipVerify: false, } tlsConfig, err := consulapi.SetupTLSConfig(tlsConfigDesc) if err != nil { - log.Fatal("Cannot set up Consul TLSConfig", err) + log.Fatal("Cannot set up Consul TLSConfig", err) } config.Scheme = "https" transport := cleanhttp.DefaultPooledTransport() transport.TLSClientConfig = tlsConfig - config.HttpClient.Transport = transport + config.Transport = transport config.Address = uri.Host } else if uri.Host != "" { config.Address = uri.Host