Skip to content

Commit

Permalink
Add Proxy support for HTTP and HTTPS requests
Browse files Browse the repository at this point in the history
  • Loading branch information
CapCaWork committed Dec 18, 2021
1 parent fe77fab commit 30f79e6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/datasource/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"net/http"
"context"
"fmt"
"time"
"io/ioutil"
dac "github.com/xinsnake/go-http-digest-auth-client"

Expand All @@ -29,6 +30,12 @@ func (c *MongoDBAtlasClient) query(ctx context.Context, path string, query map[s
log.DefaultLogger.Debug("MakeHttpRequest", "URL", uri)

var t = dac.NewTransport(c.settings.PublicKey, c.settings.PrivateKey)
t.HTTPClient = &http.Client{
Timeout: time.Second * 10,
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
},
}
req, err := http.NewRequest(method, uri, nil)

if query != nil {
Expand Down

0 comments on commit 30f79e6

Please sign in to comment.