[Feature] Add ability to include liquid in TOML files, pass through liquid renderer before parsing as TOML #4118
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.
WHY are these changes introduced?
There is currently no way to template toml file if you want to supply some of the values via environment variables. I believe the recommended approach to handling multiple environments is to have multiple named configuration files. While this works, I still think it is risky to include the working production config in a repo and would rather supply the production key at deploy time in an isolated environment.
WHAT is this pull request doing?
Since this project already uses Liquid I opted to use that as the templating language that can be used within the toml files. This PR passes all toml files through a Liquid renderer providing the environment variables as data to the rendered before parsing the toml file.
How to test your changes?
I have added tests to this PR but I am not able to test them as I can't install the development dependencies. You can also test this PR by using a TOML file with liquid in it and running any of the cli commands.
Example shopify.app.toml:
Running the cli deploy command should succeed if given valid environment variables ex.
SHOPIFY_APP_API_KEY=key SHOPIFY_APP_NAME=test npm run deploy
Measuring impact
How do we know this change was effective? Please choose one:
Checklist