mirror of https://github.com/status-im/consul.git
command: style fixes for env addr reading
This commit is contained in:
parent
4c3ec248a5
commit
e2eff5698e
|
@ -43,12 +43,10 @@ func HTTPClient(addr string) (*consulapi.Client, error) {
|
||||||
// HTTPClientDC returns a new Consul HTTP client with the given address and datacenter
|
// HTTPClientDC returns a new Consul HTTP client with the given address and datacenter
|
||||||
func HTTPClientDC(addr, dc string) (*consulapi.Client, error) {
|
func HTTPClientDC(addr, dc string) (*consulapi.Client, error) {
|
||||||
conf := consulapi.DefaultConfig()
|
conf := consulapi.DefaultConfig()
|
||||||
switch {
|
if envAddr := os.Getenv("CONSUL_HTTP_ADDR"); addr != "" {
|
||||||
case len(os.Getenv("CONSUL_HTTP_ADDR")) > 0:
|
addr = envAddr
|
||||||
conf.Address = os.Getenv("CONSUL_HTTP_ADDR")
|
|
||||||
default:
|
|
||||||
conf.Address = addr
|
|
||||||
}
|
}
|
||||||
|
conf.Address = addr
|
||||||
conf.Datacenter = dc
|
conf.Datacenter = dc
|
||||||
return consulapi.NewClient(conf)
|
return consulapi.NewClient(conf)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue