From 72c9655f1772747119afa8233f80ffda667fc440 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Tue, 14 Jul 2020 16:28:07 +0200 Subject: [PATCH] Allow empty network.proxy setting (#830) This workaround must be here until viper can UnSet properties: https://github.com/spf13/viper/pull/519 --- httpclient/httpclient_config.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/httpclient/httpclient_config.go b/httpclient/httpclient_config.go index fe44d0a12da..9fdf540fc21 100644 --- a/httpclient/httpclient_config.go +++ b/httpclient/httpclient_config.go @@ -37,7 +37,11 @@ func DefaultConfig() (*Config, error) { var err error if viper.IsSet("network.proxy") { proxyConfig := viper.GetString("network.proxy") - if proxy, err = url.Parse(proxyConfig); err != nil { + if proxyConfig == "" { + // empty configuration + // this workaround must be here until viper can UnSet properties: + // https://github.com/spf13/viper/pull/519 + } else if proxy, err = url.Parse(proxyConfig); err != nil { return nil, errors.New("Invalid network.proxy '" + proxyConfig + "': " + err.Error()) } }