summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/prometheus/common/config/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/prometheus/common/config/config.go')
-rw-r--r--vendor/github.com/prometheus/common/config/config.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/vendor/github.com/prometheus/common/config/config.go b/vendor/github.com/prometheus/common/config/config.go
index 33eb922ce..9195c34bf 100644
--- a/vendor/github.com/prometheus/common/config/config.go
+++ b/vendor/github.com/prometheus/common/config/config.go
@@ -28,3 +28,20 @@ func checkOverflow(m map[string]interface{}, ctx string) error {
}
return nil
}
+
+// Secret special type for storing secrets.
+type Secret string
+
+// MarshalYAML implements the yaml.Marshaler interface for Secrets.
+func (s Secret) MarshalYAML() (interface{}, error) {
+ if s != "" {
+ return "<secret>", nil
+ }
+ return nil, nil
+}
+
+//UnmarshalYAML implements the yaml.Unmarshaler interface for Secrets.
+func (s *Secret) UnmarshalYAML(unmarshal func(interface{}) error) error {
+ type plain Secret
+ return unmarshal((*plain)(s))
+}