Update config to allow showing secret values when marshaled #4158
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have a deployment where a sidecar between the config-reloader and alertmanager loads and unmarshals a base configuration, extends it with more routes and receivers, and then marshals it back for the alertmanager.
However, the default Marshal implementations in the receivers hide all Secret and SecretURLs when marshaling the config back to a YAML. We have to duplicate all the receiver structs in our code to be able to switch them to plain strings and URLs.
I'd be helpful to be able to re-use the structs already here in the alertmanager.
This is already supported by some of the Prometheus common configs by using a global
MarshalSecretValue
here.For now, I'm adding support for a
MarshalSecretValue
here as well. I think the Secret in this repo could also be replaced for the Secret in Prometheus common configs, but I'd like to try this first, as switching to the common Secret would be a longer PR.