Skip to content

Commit f9eb271

Browse files
author
Julien Pivotto
committed
Reuse Prometheus/prometheus pattern
Signed-off-by: Julien Pivotto <[email protected]>
1 parent 062d0d0 commit f9eb271

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

config/http_config.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ import (
3333
"gopkg.in/yaml.v2"
3434
)
3535

36+
// DefaultHTTPClientConfig is the default HTTP client configuration.
37+
var DefaultHTTPClientConfig = HTTPClientConfig{
38+
FollowRedirects: true,
39+
}
40+
3641
type closeIdler interface {
3742
CloseIdleConnections()
3843
}
@@ -111,7 +116,7 @@ type HTTPClientConfig struct {
111116
ProxyURL URL `yaml:"proxy_url,omitempty"`
112117
// TLSConfig to use to connect to the targets.
113118
TLSConfig TLSConfig `yaml:"tls_config,omitempty"`
114-
// FollowRedirects specifies wheter the client should follow the HTTP 3xx redirects.
119+
// FollowRedirects specifies wheter the client should follow HTTP 3xx redirects.
115120
// The omitempty flag is not set, because it would be hidden from the
116121
// marshalled configuration when set to false.
117122
FollowRedirects bool `yaml:"follow_redirects"`
@@ -176,9 +181,7 @@ func (c *HTTPClientConfig) Validate() error {
176181
// UnmarshalYAML implements the yaml.Unmarshaler interface
177182
func (c *HTTPClientConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
178183
type plain HTTPClientConfig
179-
*c = HTTPClientConfig{
180-
FollowRedirects: true,
181-
}
184+
*c = DefaultHTTPClientConfig
182185
if err := unmarshal((*plain)(c)); err != nil {
183186
return err
184187
}

0 commit comments

Comments
 (0)