Skip to content

Commit

Permalink
Apply suggestion
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
  • Loading branch information
roidelapluie committed Sep 28, 2021
1 parent 8b69bf4 commit a66304f
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions config/http_config.go
Expand Up @@ -117,15 +117,16 @@ func (u URL) MarshalYAML() (interface{}, error) {

// Redacted returns the URL but replaces any password with "xxxxx".
func (u URL) Redacted() string {
if u.URL != nil {
ru := *u.URL
if _, ok := ru.User.Password(); ok {
// We can not use secretToken because it would be escaped.
ru.User = url.UserPassword(ru.User.Username(), "xxxxx")
}
return ru.String()
if u.URL == nil {
return ""
}

ru := *u.URL
if _, ok := ru.User.Password(); ok {
// We can not use secretToken because it would be escaped.
ru.User = url.UserPassword(ru.User.Username(), "xxxxx")
}
return ""
return ru.String()
}

// UnmarshalJSON implements the json.Marshaler interface for URL.
Expand Down

0 comments on commit a66304f

Please sign in to comment.