From 5057b857f6fbcd409ed6803c95323e980729ad04 Mon Sep 17 00:00:00 2001 From: Yitao Jiang Date: Tue, 12 Sep 2017 11:54:48 +0800 Subject: [PATCH] Read the proxy environment variable to call service api --- cfmysql/http_client_factory.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cfmysql/http_client_factory.go b/cfmysql/http_client_factory.go index fdec21d..d12ebf5 100644 --- a/cfmysql/http_client_factory.go +++ b/cfmysql/http_client_factory.go @@ -1,8 +1,8 @@ package cfmysql import ( - "net/http" "crypto/tls" + "net/http" ) //go:generate counterfeiter . HttpClientFactory @@ -14,11 +14,12 @@ func NewHttpClientFactory() HttpClientFactory { return new(httpClientFactory) } -type httpClientFactory struct {} +type httpClientFactory struct{} func (self *httpClientFactory) NewClient(sslDisabled bool) *http.Client { transport := &http.Transport{ + Proxy: http.ProxyFromEnvironment, TLSClientConfig: &tls.Config{InsecureSkipVerify: sslDisabled}, } return &http.Client{Transport: transport} -} \ No newline at end of file +}