Skip to content

Commit

Permalink
used http.DefaultTransport to inherit system properties for proxy set…
Browse files Browse the repository at this point in the history
…tings and etc. (#172)
  • Loading branch information
stikkireddy committed Jul 14, 2020
1 parent d16d18b commit 05732ff
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions client/service/client.go
Expand Up @@ -119,10 +119,19 @@ func (c *DBApiClientConfig) Setup() {
// a transient error on initial creation
retryDelayDuration := 10 * time.Second
retryMaximumDuration := 5 * time.Minute
// Default transport will inherit from env variables and system settings such as HTTP_PROXY and NO_PROXY
defaultTransport := http.DefaultTransport.(*http.Transport)
c.client = &retryablehttp.Client{
HTTPClient: &http.Client{
Timeout: time.Duration(c.TimeoutSeconds) * time.Second,
Transport: &http.Transport{
Proxy: defaultTransport.Proxy,
DialContext: defaultTransport.DialContext,
MaxIdleConns: defaultTransport.MaxIdleConns,
IdleConnTimeout: defaultTransport.IdleConnTimeout,
TLSHandshakeTimeout: defaultTransport.TLSHandshakeTimeout,
ExpectContinueTimeout: defaultTransport.ExpectContinueTimeout,
// TODO: This probably should be a configuration at the provider level and optional and not a fixed val
TLSClientConfig: &tls.Config{
InsecureSkipVerify: c.InsecureSkipVerify,
},
Expand Down

0 comments on commit 05732ff

Please sign in to comment.