python-consul icon indicating copy to clipboard operation
python-consul copied to clipboard

Environment variables should not have precedence over `Consul` constructor arguments

Open colin-nolan opened this issue 7 years ago • 1 comments

The token passed in as an argument in the constructor is overriden by the CONSUL_HTTP_TOKEN (if set): https://github.com/cablehead/python-consul/blob/d056ff5c4efc6a5642775ad66600864e3f0f6cbc/consul/base.py#L311

The same is true with the host and port (and others!): https://github.com/cablehead/python-consul/blob/d056ff5c4efc6a5642775ad66600864e3f0f6cbc/consul/base.py#L297-L299

I would argue that this is not the behaviour most would expect. It would be better if the precedence order was argument > env > default.

colin-nolan avatar Feb 07 '18 11:02 colin-nolan

Suggested fix in https://github.com/cablehead/python-consul/pull/193.

colin-nolan avatar Feb 07 '18 15:02 colin-nolan