Fwd Pxy Support (#27) * Fwd Pxy Support * glide update * revert glide.yaml to master post code approval.
diff --git a/init.go b/init.go index 20d6478..4ff6d3c 100644 --- a/init.go +++ b/init.go
@@ -17,9 +17,12 @@ import ( "fmt" "github.com/apid/apid-core" + "github.com/apid/apid-core/util" + "net/http" "os" "path/filepath" "sync" + "time" ) const ( @@ -63,6 +66,7 @@ events apid.EventsService unsafeDB apid.DB dbMux sync.RWMutex + client *http.Client localAnalyticsBaseDir string localAnalyticsTempDir string @@ -182,6 +186,11 @@ // set default config for internal buffer size config.SetDefault(analyticsBufferChannelSize, analyticsBufferChannelSizeDefault) + client = &http.Client{ + Transport: util.Transport(config.GetString(util.ConfigfwdProxyPortURL)), + //set default timeout of 60 seconds while connecting to s3/GCS + Timeout: time.Duration(60 * time.Second), + } return nil }
diff --git a/uploader.go b/uploader.go index c37a257..98db172 100644 --- a/uploader.go +++ b/uploader.go
@@ -29,11 +29,6 @@ var token string -var client *http.Client = &http.Client{ - //set default timeout of 60 seconds while connecting to s3/GCS - Timeout: time.Duration(60 * time.Second), -} - func addHeaders(req *http.Request) { token = config.GetString("apigeesync_bearer_token") req.Header.Add("Authorization", "Bearer "+token)