Simple way to override env vars from command line #42
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 just needed this so I could commit the postgis sharkdown demo file I have to the AoH repo. Like docker you can specify multiple -e KEY=VALUE env vars, but they only override ones that are in the sharkdown, they don't add new things (on the grounds we want all state to be explicit in the sharkdown file. The output sharkdown file has the substituted values in it.
I thought of doing this in the AST, but currently we only evaluate shell built-in equivalent commands at execution time, so in the end I went back on that change and just evaluate it at execution time. I'm not wedded to this, it was just the easiest way to get something in. Similarly this could come from a .env file rather than flags or such, but I just needed something of this form fast, so went with args for now.