PlayFab / consuldotnet

.NET API for Consul (http://www.consul.io/)
Apache License 2.0
692 stars 193 forks source link

ConsulConfigurationException throw if URL scheme specified in CONSUL_HTTP_ADDR environment variable. #115

Closed goss2326 closed 6 years ago

goss2326 commented 6 years ago

This error occurs in this file: https://github.com/PlayFab/consuldotnet/blob/master/Consul/Client.cs

A ConsulConfigurationException is thrown when constructing an instance of ConsulClientConfiguration if it finds a value in the environment variable CONSUL_HTTP_ADDR that includes the URL scheme (http/https).

For example, if the environment variable is set to http://127.0.0.1:8500 it will fail because it is doing a string splint on : and expected the second part to be the port number, but with this example it is the third part.

It also seems strange that it is checking for this, when the address value just gets overwritten anyway by the default constructor.

goss2326 commented 6 years ago

Actually, upon reviewing the consul documentation (here: https://www.consul.io/docs/commands/index.html#consul_http_addr) it's recommended not to specify the URL scheme in the environment variable.

Will close this issue