diff --git a/.golangci.yml b/.golangci.yml index db2ad414..110b428f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -162,6 +162,4 @@ formatters: extra-rules: true goimports: local-prefixes: - - github.com/prometheus/common - exclusions: - generated: lax + - github.com/prometheus/common \ No newline at end of file diff --git a/config/http_config.go b/config/http_config.go index bc906bc6..55cc5b07 100644 --- a/config/http_config.go +++ b/config/http_config.go @@ -136,7 +136,7 @@ func (tv *TLSVersion) String() string { // BasicAuth contains basic HTTP authentication credentials. type BasicAuth struct { - Username string `yaml:"username" json:"username"` + Username string `yaml:"username,omitempty" json:"username,omitempty"` UsernameFile string `yaml:"username_file,omitempty" json:"username_file,omitempty"` // UsernameRef is the name of the secret within the secret manager to use as the username. UsernameRef string `yaml:"username_ref,omitempty" json:"username_ref,omitempty"` @@ -238,22 +238,22 @@ func (u URL) MarshalJSON() ([]byte, error) { // OAuth2 is the oauth2 client configuration. type OAuth2 struct { - ClientID string `yaml:"client_id" json:"client_id"` - ClientSecret Secret `yaml:"client_secret" json:"client_secret"` - ClientSecretFile string `yaml:"client_secret_file" json:"client_secret_file"` + ClientID string `yaml:"client_id,omitempty" json:"client_id,omitempty"` + ClientSecret Secret `yaml:"client_secret,omitempty" json:"client_secret,omitempty"` + ClientSecretFile string `yaml:"client_secret_file,omitempty" json:"client_secret_file,omitempty"` // ClientSecretRef is the name of the secret within the secret manager to use as the client // secret. - ClientSecretRef string `yaml:"client_secret_ref" json:"client_secret_ref"` - ClientCertificateKeyID string `yaml:"client_certificate_key_id" json:"client_certificate_key_id"` - ClientCertificateKey Secret `yaml:"client_certificate_key" json:"client_certificate_key"` - ClientCertificateKeyFile string `yaml:"client_certificate_key_file" json:"client_certificate_key_file"` + ClientSecretRef string `yaml:"client_secret_ref,omitempty" json:"client_secret_ref,omitempty"` + ClientCertificateKeyID string `yaml:"client_certificate_key_id,omitempty" json:"client_certificate_key_id,omitempty"` + ClientCertificateKey Secret `yaml:"client_certificate_key,omitempty" json:"client_certificate_key,omitempty"` + ClientCertificateKeyFile string `yaml:"client_certificate_key_file,omitempty" json:"client_certificate_key_file,omitempty"` // ClientCertificateKeyRef is the name of the secret within the secret manager to use as the client // secret. - ClientCertificateKeyRef string `yaml:"client_certificate_key_ref" json:"client_certificate_key_ref"` + ClientCertificateKeyRef string `yaml:"client_certificate_key_ref,omitempty" json:"client_certificate_key_ref,omitempty"` // GrantType is the OAuth2 grant type to use. It can be one of // "client_credentials" or "urn:ietf:params:oauth:grant-type:jwt-bearer" (RFC 7523). // Default value is "client_credentials" - GrantType string `yaml:"grant_type" json:"grant_type"` + GrantType string `yaml:"grant_type,omitempty" json:"grant_type,omitempty"` // SignatureAlgorithm is the RSA algorithm used to sign JWT token. Only used if // GrantType is set to "urn:ietf:params:oauth:grant-type:jwt-bearer". // Default value is RS256 and valid values RS256, RS384, RS512 @@ -271,7 +271,7 @@ type OAuth2 struct { // GrantType is set to "urn:ietf:params:oauth:grant-type:jwt-bearer". Claims map[string]interface{} `yaml:"claims,omitempty" json:"claims,omitempty"` Scopes []string `yaml:"scopes,omitempty" json:"scopes,omitempty"` - TokenURL string `yaml:"token_url" json:"token_url"` + TokenURL string `yaml:"token_url,omitempty" json:"token_url,omitempty"` EndpointParams map[string]string `yaml:"endpoint_params,omitempty" json:"endpoint_params,omitempty"` TLSConfig TLSConfig `yaml:"tls_config,omitempty"` ProxyConfig `yaml:",inline"`