python-consul
python-consul copied to clipboard
Environment variables should not have precedence over `Consul` constructor arguments
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.
Suggested fix in https://github.com/cablehead/python-consul/pull/193.