2021-08-04 20:56:18 +00:00
|
|
|
package options
|
|
|
|
|
|
|
|
type SecretString struct {
|
|
|
|
s *string
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewSecretString(s string) SecretString {
|
|
|
|
return SecretString{s: &s}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s SecretString) GoString() string {
|
|
|
|
return `"` + s.String() + `"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s SecretString) String() string {
|
2022-07-02 17:44:28 +00:00
|
|
|
if s.s == nil || len(*s.s) == 0 {
|
2021-08-04 20:56:18 +00:00
|
|
|
return ``
|
|
|
|
}
|
|
|
|
return `**redacted**`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *SecretString) Unwrap() string {
|
2022-07-02 17:44:28 +00:00
|
|
|
if s.s == nil {
|
|
|
|
return ""
|
|
|
|
}
|
2021-08-04 20:56:18 +00:00
|
|
|
return *s.s
|
|
|
|
}
|