From 7b08f9d09951bc01524554ae64195b49862bdb2d Mon Sep 17 00:00:00 2001 From: Daniel Nelson Date: Fri, 8 Sep 2017 15:35:20 -0700 Subject: [PATCH] Add support for standard proxy env vars in outputs. (#3212) --- plugins/outputs/amon/amon.go | 3 +++ plugins/outputs/datadog/datadog.go | 4 ++++ plugins/outputs/influxdb/client/http.go | 1 + plugins/outputs/librato/librato.go | 3 +++ 4 files changed, 11 insertions(+) diff --git a/plugins/outputs/amon/amon.go b/plugins/outputs/amon/amon.go index a113f2616..10298173f 100644 --- a/plugins/outputs/amon/amon.go +++ b/plugins/outputs/amon/amon.go @@ -48,6 +48,9 @@ func (a *Amon) Connect() error { return fmt.Errorf("serverkey and amon_instance are required fields for amon output") } a.client = &http.Client{ + Transport: &http.Transport{ + Proxy: http.ProxyFromEnvironment, + }, Timeout: a.Timeout.Duration, } return nil diff --git a/plugins/outputs/datadog/datadog.go b/plugins/outputs/datadog/datadog.go index cf54de725..6d7531eb5 100644 --- a/plugins/outputs/datadog/datadog.go +++ b/plugins/outputs/datadog/datadog.go @@ -55,7 +55,11 @@ func (d *Datadog) Connect() error { if d.Apikey == "" { return fmt.Errorf("apikey is a required field for datadog output") } + d.client = &http.Client{ + Transport: &http.Transport{ + Proxy: http.ProxyFromEnvironment, + }, Timeout: d.Timeout.Duration, } return nil diff --git a/plugins/outputs/influxdb/client/http.go b/plugins/outputs/influxdb/client/http.go index 2587b2da5..d8c1951f5 100644 --- a/plugins/outputs/influxdb/client/http.go +++ b/plugins/outputs/influxdb/client/http.go @@ -53,6 +53,7 @@ func NewHTTP(config HTTPConfig, defaultWP WriteParams) (Client, error) { } } else { transport = http.Transport{ + Proxy: http.ProxyFromEnvironment, TLSClientConfig: config.TLSConfig, } } diff --git a/plugins/outputs/librato/librato.go b/plugins/outputs/librato/librato.go index ed020d54f..abd3b055f 100644 --- a/plugins/outputs/librato/librato.go +++ b/plugins/outputs/librato/librato.go @@ -80,6 +80,9 @@ func (l *Librato) Connect() error { "api_user and api_token are required fields for librato output") } l.client = &http.Client{ + Transport: &http.Transport{ + Proxy: http.ProxyFromEnvironment, + }, Timeout: l.Timeout.Duration, } return nil