Closed seanhinde closed 5 months ago
I've merged this because I agree we should ideally see local vars take over the global ones. I do share the risk around breakage there, but I'm not quite sure there's anything we can do to de-risk that.
Tremendous, thanks very much
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 https://github.com/erlware/relx/issues/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.