Skip to content

Instantly share code, notes, and snippets.

@awgreene
Created July 11, 2019 01:27
Show Gist options
  • Save awgreene/9cb7454d7bea3e66a6e91814783094fc to your computer and use it in GitHub Desktop.
Save awgreene/9cb7454d7bea3e66a6e91814783094fc to your computer and use it in GitHub Desktop.
// A custom HTTPClient is used here since the default HTTPClients ProxyFromEnvironment
// uses a cache which won't let us update the proxy env vars
sess, err := session.NewSession(&aws.Config{
Credentials: credentials.NewStaticCredentials(cfg.AccessKey, cfg.SecretKey, ""),
Region: &d.Config.Region,
Endpoint: &d.Config.RegionEndpoint,
HTTPClient: &http.Client{
Transport: &http.Transport{
Proxy: func(req *http.Request) (*url.URL, error) {
return httpproxy.FromEnvironment().ProxyFunc()(req.URL)
},
},
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment