summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/prometheus/common/config/http_config.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/prometheus/common/config/http_config.go')
-rw-r--r--vendor/github.com/prometheus/common/config/http_config.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/vendor/github.com/prometheus/common/config/http_config.go b/vendor/github.com/prometheus/common/config/http_config.go
index ff5837fa5..ea231bf8d 100644
--- a/vendor/github.com/prometheus/common/config/http_config.go
+++ b/vendor/github.com/prometheus/common/config/http_config.go
@@ -22,7 +22,7 @@ import (
"net/url"
"strings"
- yaml "gopkg.in/yaml.v2"
+ "gopkg.in/yaml.v2"
)
// BasicAuth contains basic HTTP authentication credentials.
@@ -79,7 +79,9 @@ type HTTPClientConfig struct {
XXX map[string]interface{} `yaml:",inline"`
}
-func (c *HTTPClientConfig) validate() error {
+// Validate validates the HTTPClientConfig to check only one of BearerToken,
+// BasicAuth and BearerTokenFile is configured.
+func (c *HTTPClientConfig) Validate() error {
if len(c.BearerToken) > 0 && len(c.BearerTokenFile) > 0 {
return fmt.Errorf("at most one of bearer_token & bearer_token_file must be configured")
}
@@ -96,9 +98,9 @@ func (c *HTTPClientConfig) UnmarshalYAML(unmarshal func(interface{}) error) erro
if err != nil {
return err
}
- err = c.validate()
+ err = c.Validate()
if err != nil {
- return c.validate()
+ return c.Validate()
}
return checkOverflow(c.XXX, "http_client_config")
}