Add per template override of overlay vars #933
Merged
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.
This PR adds the possibility to have a different overlay_vars file applied to each template line in a release. This allows creation of multiple output files with different content from a single template file.
It implements the discussion from #757
So from a single template file e.g.
priv/app.config
containingit will be possible to generate multiple output files in the same release:
where host1_overlay_vars.config could contain
and host2_overlay_vars.config could contain
generating two output files.
This PR includes a test case.
There is one change here I'm not sure about. When there is also a global
overlay_vars
file it would be nice if the template specific variables could override the global ones. In the implementation I've re-usedrex_overlay:read_overlay_vars/3
but that function always makes newer variables hidden if they are already set. I've changed its behaviour, but this could cause breakage.In my case I don't need this - I always set all the vars in each vars file, but it seems useful. Could also be fixed by making a copy of the read_overlay_vars function with the different ordering. I'd welcome some input here.