Add support for include-file-directive in config files. - #3771
Merged
t2gran merged 4 commits intoDec 16, 2021
Conversation
Member
Author
|
In the dev-meeting today, I got some feedback that the "preview version" of this did not worh, due to white-space before/after the |
leonardehrenfried
previously approved these changes
Dec 13, 2021
leonardehrenfried
left a comment
Member
There was a problem hiding this comment.
I ran the code and it does what it should. The code also looks good.
hannesj
reviewed
Dec 15, 2021
Co-authored-by: Hannes Junnila <hannes.junnila@gmail.com>
Co-authored-by: Hannes Junnila <hannes.junnila@gmail.com>
Allow the filename to contain dash as well
hannesj
approved these changes
Dec 15, 2021
leonardehrenfried
approved these changes
Dec 16, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This feature make it possible to inject the content of another file into a configuration file. It make it possible to keep part of the configuration in separate files. To include the content of a file use
${includeFile:FILE_NAME}. TheFILE_NAMEmust be the name of a file in the configuration directory. Relative paths are not supported.To allow both files (the configuration file and the injected file) to be valid JSON files a special case is supported; If the include file directive is quoted, then the quotes are removed if the text inserted is valid JSON. We check that the text to inject start with a `{` and ends with `}`.
Variable substitution is performed on the configuration file after the include file directive; Hence
variable substitution is also performed on the text in the injected file, but not inside the
${includeFile:FILE_NAME}.Here is an example including variable substitution, assuming version 2.1.0 of OTP:
The result will look like this:
{ "storage" : { "streetGraph": "street-graph-v2.1.0.obj" } }Issue
There is no issue for this, but this feature where requested as part of the #3760.
Unit tests
✅
Code style
✅
Documentation
✅