Skip to content

Commit

Permalink
feat: use proxy from environment (#1885)
Browse files Browse the repository at this point in the history
* feat: use proxy from environment

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* Update internal/client/github.go

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
caarlos0 and kodiakhq[bot] committed Nov 5, 2020
1 parent 032a105 commit f1049b9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/client/gitea.go
Expand Up @@ -40,6 +40,7 @@ func NewGitea(ctx *context.Context, token string) (Client, error) {
return nil, err
}
transport := &http.Transport{
Proxy: http.ProxyFromEnvironment,
TLSClientConfig: &tls.Config{
// nolint: gosec
InsecureSkipVerify: ctx.Config.GiteaURLs.SkipTLSVerify,
Expand Down
1 change: 1 addition & 0 deletions internal/client/github.go
Expand Up @@ -38,6 +38,7 @@ func NewGitHub(ctx *context.Context, token string) (Client, error) {
base.(*http.Transport).TLSClientConfig = &tls.Config{
InsecureSkipVerify: ctx.Config.GitHubURLs.SkipTLSVerify,
}
base.(*http.Transport).Proxy = http.ProxyFromEnvironment
httpClient.Transport.(*oauth2.Transport).Base = base
client := github.NewClient(httpClient)
if ctx.Config.GitHubURLs.API != "" {
Expand Down
1 change: 1 addition & 0 deletions internal/client/gitlab.go
Expand Up @@ -28,6 +28,7 @@ type gitlabClient struct {
// NewGitLab returns a gitlab client implementation.
func NewGitLab(ctx *context.Context, token string) (Client, error) {
transport := &http.Transport{
Proxy: http.ProxyFromEnvironment,
TLSClientConfig: &tls.Config{
// nolint: gosec
InsecureSkipVerify: ctx.Config.GitLabURLs.SkipTLSVerify,
Expand Down
1 change: 1 addition & 0 deletions internal/http/http.go
Expand Up @@ -311,6 +311,7 @@ func getHTTPClient(upload *config.Upload) (*h.Client, error) {
pool.AppendCertsFromPEM([]byte(upload.TrustedCerts)) // already validated certs checked by CheckConfig
return &h.Client{
Transport: &h.Transport{
Proxy: h.ProxyFromEnvironment,
TLSClientConfig: &tls.Config{ // nolint: gosec
RootCAs: pool,
},
Expand Down

1 comment on commit f1049b9

@vercel
Copy link

@vercel vercel bot commented on f1049b9 Nov 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.