mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-04-15 11:56:56 +02:00
feat: use proxy from environment (#1885)
* 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>
This commit is contained in:
parent
032a105533
commit
f1049b94ef
@ -40,6 +40,7 @@ func NewGitea(ctx *context.Context, token string) (Client, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
transport := &http.Transport{
|
transport := &http.Transport{
|
||||||
|
Proxy: http.ProxyFromEnvironment,
|
||||||
TLSClientConfig: &tls.Config{
|
TLSClientConfig: &tls.Config{
|
||||||
// nolint: gosec
|
// nolint: gosec
|
||||||
InsecureSkipVerify: ctx.Config.GiteaURLs.SkipTLSVerify,
|
InsecureSkipVerify: ctx.Config.GiteaURLs.SkipTLSVerify,
|
||||||
|
@ -38,6 +38,7 @@ func NewGitHub(ctx *context.Context, token string) (Client, error) {
|
|||||||
base.(*http.Transport).TLSClientConfig = &tls.Config{
|
base.(*http.Transport).TLSClientConfig = &tls.Config{
|
||||||
InsecureSkipVerify: ctx.Config.GitHubURLs.SkipTLSVerify,
|
InsecureSkipVerify: ctx.Config.GitHubURLs.SkipTLSVerify,
|
||||||
}
|
}
|
||||||
|
base.(*http.Transport).Proxy = http.ProxyFromEnvironment
|
||||||
httpClient.Transport.(*oauth2.Transport).Base = base
|
httpClient.Transport.(*oauth2.Transport).Base = base
|
||||||
client := github.NewClient(httpClient)
|
client := github.NewClient(httpClient)
|
||||||
if ctx.Config.GitHubURLs.API != "" {
|
if ctx.Config.GitHubURLs.API != "" {
|
||||||
|
@ -28,6 +28,7 @@ type gitlabClient struct {
|
|||||||
// NewGitLab returns a gitlab client implementation.
|
// NewGitLab returns a gitlab client implementation.
|
||||||
func NewGitLab(ctx *context.Context, token string) (Client, error) {
|
func NewGitLab(ctx *context.Context, token string) (Client, error) {
|
||||||
transport := &http.Transport{
|
transport := &http.Transport{
|
||||||
|
Proxy: http.ProxyFromEnvironment,
|
||||||
TLSClientConfig: &tls.Config{
|
TLSClientConfig: &tls.Config{
|
||||||
// nolint: gosec
|
// nolint: gosec
|
||||||
InsecureSkipVerify: ctx.Config.GitLabURLs.SkipTLSVerify,
|
InsecureSkipVerify: ctx.Config.GitLabURLs.SkipTLSVerify,
|
||||||
|
@ -311,6 +311,7 @@ func getHTTPClient(upload *config.Upload) (*h.Client, error) {
|
|||||||
pool.AppendCertsFromPEM([]byte(upload.TrustedCerts)) // already validated certs checked by CheckConfig
|
pool.AppendCertsFromPEM([]byte(upload.TrustedCerts)) // already validated certs checked by CheckConfig
|
||||||
return &h.Client{
|
return &h.Client{
|
||||||
Transport: &h.Transport{
|
Transport: &h.Transport{
|
||||||
|
Proxy: h.ProxyFromEnvironment,
|
||||||
TLSClientConfig: &tls.Config{ // nolint: gosec
|
TLSClientConfig: &tls.Config{ // nolint: gosec
|
||||||
RootCAs: pool,
|
RootCAs: pool,
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user