mirror of
https://github.com/restic/rest-server.git
synced 2025-12-07 09:36:13 -08:00
Update dependencies
This commit is contained in:
10
vendor/github.com/prometheus/common/config/http_config.go
generated
vendored
10
vendor/github.com/prometheus/common/config/http_config.go
generated
vendored
@@ -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")
|
||||
}
|
||||
|
||||
2
vendor/github.com/prometheus/common/config/http_config_test.go
generated
vendored
2
vendor/github.com/prometheus/common/config/http_config_test.go
generated
vendored
@@ -114,7 +114,7 @@ func TestValidateHTTPConfig(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Errorf("Error loading HTTP client config: %v", err)
|
||||
}
|
||||
err = cfg.validate()
|
||||
err = cfg.Validate()
|
||||
if err != nil {
|
||||
t.Fatalf("Error validating %s: %s", "testdata/http.conf.good.yml", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user