String hides the underlying value.
(sv *Values)
| 28 | |
| 29 | // String hides the underlying value. |
| 30 | func (s *MaskedSetting) String(sv *Values) string { |
| 31 | // Special case for non-reportable/sensitive strings: we still want |
| 32 | // to distinguish empty from non-empty (= customized). |
| 33 | if st, ok := s.setting.(*StringSetting); ok && st.String(sv) == "" { |
| 34 | return "" |
| 35 | } |
| 36 | isSensitive := false |
| 37 | if st, ok := s.setting.(internalSetting); ok { |
| 38 | isSensitive = st.isSensitive() |
| 39 | } |
| 40 | sensitiveRedactionEnabled := redactSensitiveSettingsEnabled.Get(sv) |
| 41 | // Non-reportable settings are always redacted. Sensitive settings are |
| 42 | // redacted if the redaction cluster setting is enabled. |
| 43 | if !isSensitive || sensitiveRedactionEnabled { |
| 44 | return "<redacted>" |
| 45 | } |
| 46 | return s.setting.String(sv) |
| 47 | } |
| 48 | |
| 49 | // DefaultString returns the default value for the setting as a string. |
| 50 | func (s *MaskedSetting) DefaultString() string { |
nothing calls this directly
no test coverage detected