mantl / consul-cli

Command line interface to Consul HTTP API
Apache License 2.0
251 stars 67 forks source link

CONSUL_HTTP_ADDR not recognized #3

Closed itn3rd77 closed 8 years ago

itn3rd77 commented 9 years ago

Hi!

The documentation stated the following:

--consul
Address of the Consul agent in the form hostname:port. The default is 127.0.0.1:8500. Can also be set with the environment variable CONSUL_HTTP_ADDR

I have exported the environment variable CONSUL_HTTP_ADDR but consul-cli is still using the default 127.0.0.1:8500:

export CONSUL_HTTP_ADDR=consul.service.consul:8500
consul-cli status-leader
Get http://127.0.0.1:8500/v1/status/leader: dial tcp 127.0.0.1:8500: connection refused

I have use consul-cli status-leader --consul=${CONSUL_HTTP_ADDR} to get things working. Is this what the documentation is saying?

Regards Ingo

ChrisAubuchon commented 9 years ago

Nope. You shouldn't need --consul=${CONSUL_HTTP_ADDR}. Check out commit https://github.com/CiscoCloud/consul-cli/commit/1132e7285d9a365084b247e085c28463ba6c0d93. That should fix the issue.

itn3rd77 commented 9 years ago

Tested https://github.com/CiscoCloud/consul-cli/commit/1132e7285d9a365084b247e085c28463ba6c0d93 and works as expected!

Thanks for the quick fix!

EugenMayer commented 8 years ago

seems not to be part of the 2.0 release, isnt it?

(root:nginx_base)➜  /  echo $CONSUL_HTTP_ADDR
consul:8500

(root:nginx_base)➜  / consul-cli kv read --recurse service
Get http://127.0.0.1:8500/v1/kv/service?recurse=: dial tcp 127.0.0.1:8500: getsockopt: connection refused