Skip to content

Commit a415517

Browse files
committed
adds json struct tags to mirror yaml ones
Signed-off-by: Owen Diehl <[email protected]>
1 parent b4304c5 commit a415517

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

config/http_config.go

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ type closeIdler interface {
5454

5555
// BasicAuth contains basic HTTP authentication credentials.
5656
type BasicAuth struct {
57-
Username string `yaml:"username"`
58-
Password Secret `yaml:"password,omitempty"`
59-
PasswordFile string `yaml:"password_file,omitempty"`
57+
Username string `yaml:"username" json:"username"`
58+
Password Secret `yaml:"password,omitempty" json:"password,omitempty"`
59+
PasswordFile string `yaml:"password_file,omitempty" json:"password_file,omitempty"`
6060
}
6161

6262
// SetDirectory joins any relative file paths with dir.
@@ -69,9 +69,9 @@ func (a *BasicAuth) SetDirectory(dir string) {
6969

7070
// Authorization contains HTTP authorization credentials.
7171
type Authorization struct {
72-
Type string `yaml:"type,omitempty"`
73-
Credentials Secret `yaml:"credentials,omitempty"`
74-
CredentialsFile string `yaml:"credentials_file,omitempty"`
72+
Type string `yaml:"type,omitempty" json:"type,omitempty"`
73+
Credentials Secret `yaml:"credentials,omitempty" json:"credentials,omitempty"`
74+
CredentialsFile string `yaml:"credentials_file,omitempty" json:"credentials_file,omitempty"`
7575
}
7676

7777
// SetDirectory joins any relative file paths with dir.
@@ -112,12 +112,12 @@ func (u URL) MarshalYAML() (interface{}, error) {
112112

113113
// OAuth2 is the oauth2 client configuration.
114114
type OAuth2 struct {
115-
ClientID string `yaml:"client_id"`
116-
ClientSecret Secret `yaml:"client_secret"`
117-
ClientSecretFile string `yaml:"client_secret_file"`
118-
Scopes []string `yaml:"scopes,omitempty"`
119-
TokenURL string `yaml:"token_url"`
120-
EndpointParams map[string]string `yaml:"endpoint_params,omitempty"`
115+
ClientID string `yaml:"client_id" json:"client_id"`
116+
ClientSecret Secret `yaml:"client_secret" json:"client_secret"`
117+
ClientSecretFile string `yaml:"client_secret_file" json:"client_secret_file"`
118+
Scopes []string `yaml:"scopes,omitempty" json:"scopes,omitempty"`
119+
TokenURL string `yaml:"token_url" json:"token_url"`
120+
EndpointParams map[string]string `yaml:"endpoint_params,omitempty" json:"endpoint_params,omitempty"`
121121
}
122122

123123
// SetDirectory joins any relative file paths with dir.
@@ -131,25 +131,25 @@ func (a *OAuth2) SetDirectory(dir string) {
131131
// HTTPClientConfig configures an HTTP client.
132132
type HTTPClientConfig struct {
133133
// The HTTP basic authentication credentials for the targets.
134-
BasicAuth *BasicAuth `yaml:"basic_auth,omitempty"`
134+
BasicAuth *BasicAuth `yaml:"basic_auth,omitempty" json:"basic_auth,omitempty"`
135135
// The HTTP authorization credentials for the targets.
136-
Authorization *Authorization `yaml:"authorization,omitempty"`
136+
Authorization *Authorization `yaml:"authorization,omitempty" json:"authorization,omitempty"`
137137
// The OAuth2 client credentials used to fetch a token for the targets.
138-
OAuth2 *OAuth2 `yaml:"oauth2,omitempty"`
138+
OAuth2 *OAuth2 `yaml:"oauth2,omitempty" json:"oauth2,omitempty"`
139139
// The bearer token for the targets. Deprecated in favour of
140140
// Authorization.Credentials.
141-
BearerToken Secret `yaml:"bearer_token,omitempty"`
141+
BearerToken Secret `yaml:"bearer_token,omitempty" json:"bearer_token,omitempty"`
142142
// The bearer token file for the targets. Deprecated in favour of
143143
// Authorization.CredentialsFile.
144-
BearerTokenFile string `yaml:"bearer_token_file,omitempty"`
144+
BearerTokenFile string `yaml:"bearer_token_file,omitempty" json:"bearer_token_file,omitempty"`
145145
// HTTP proxy server to use to connect to the targets.
146-
ProxyURL URL `yaml:"proxy_url,omitempty"`
146+
ProxyURL URL `yaml:"proxy_url,omitempty" json:"proxy_url,omitempty"`
147147
// TLSConfig to use to connect to the targets.
148-
TLSConfig TLSConfig `yaml:"tls_config,omitempty"`
148+
TLSConfig TLSConfig `yaml:"tls_config,omitempty" json:"tls_config,omitempty"`
149149
// FollowRedirects specifies whether the client should follow HTTP 3xx redirects.
150150
// The omitempty flag is not set, because it would be hidden from the
151151
// marshalled configuration when set to false.
152-
FollowRedirects bool `yaml:"follow_redirects"`
152+
FollowRedirects bool `yaml:"follow_redirects" json:"follow_redirects"`
153153
}
154154

155155
// SetDirectory joins any relative file paths with dir.
@@ -616,15 +616,15 @@ func NewTLSConfig(cfg *TLSConfig) (*tls.Config, error) {
616616
// TLSConfig configures the options for TLS connections.
617617
type TLSConfig struct {
618618
// The CA cert to use for the targets.
619-
CAFile string `yaml:"ca_file,omitempty"`
619+
CAFile string `yaml:"ca_file,omitempty" json:"ca_file,omitempty"`
620620
// The client cert file for the targets.
621-
CertFile string `yaml:"cert_file,omitempty"`
621+
CertFile string `yaml:"cert_file,omitempty" json:"cert_file,omitempty"`
622622
// The client key file for the targets.
623-
KeyFile string `yaml:"key_file,omitempty"`
623+
KeyFile string `yaml:"key_file,omitempty" json:"key_file,omitempty"`
624624
// Used to verify the hostname for the targets.
625-
ServerName string `yaml:"server_name,omitempty"`
625+
ServerName string `yaml:"server_name,omitempty" json:"server_name,omitempty"`
626626
// Disable target certificate validation.
627-
InsecureSkipVerify bool `yaml:"insecure_skip_verify"`
627+
InsecureSkipVerify bool `yaml:"insecure_skip_verify" json:"insecure_skip_verify"`
628628
}
629629

630630
// SetDirectory joins any relative file paths with dir.

0 commit comments

Comments
 (0)