From e2eff5698e27c1a4368e171bcf070700fab148c3 Mon Sep 17 00:00:00 2001 From: Ryan Uber Date: Fri, 16 Jan 2015 10:19:04 -0800 Subject: [PATCH] command: style fixes for env addr reading --- command/rpc.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/command/rpc.go b/command/rpc.go index f0c9e5b1fa..5c647aed30 100644 --- a/command/rpc.go +++ b/command/rpc.go @@ -43,12 +43,10 @@ func HTTPClient(addr string) (*consulapi.Client, error) { // HTTPClientDC returns a new Consul HTTP client with the given address and datacenter func HTTPClientDC(addr, dc string) (*consulapi.Client, error) { conf := consulapi.DefaultConfig() - switch { - case len(os.Getenv("CONSUL_HTTP_ADDR")) > 0: - conf.Address = os.Getenv("CONSUL_HTTP_ADDR") - default: - conf.Address = addr + if envAddr := os.Getenv("CONSUL_HTTP_ADDR"); addr != "" { + addr = envAddr } + conf.Address = addr conf.Datacenter = dc return consulapi.NewClient(conf) }