add support for modifying content after reading #17
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.
Describe the change
This is a pretty straightforward one, it just adds the ability to modify the contents of a config file after reading it, but before it gets parsed and merged.
Why are we doing this?
The boring way to use this it to append content to the config or something like that. But there are more fun things you can do with it, like scanning the content to check for any secrets that shouldn't be stored in plaintext, or... this thing that I'm doing:
With a config file like this:
This allows the config file itself to be an integration point for things like secrets management.
Benefits
The main use case I'm using this for is templating config files, and this small change is enough to allow that.
Drawbacks
This does make use of the implicit block, which would prevent it from being used for something else. An alternate (more complicated) approach would be to add some sort of hooks that could be configured, perhaps passing a proc to those that would be called at the appropriate time. That's... probably more complexity than is needed.
Requirements
master
branch?