File inclusion
Configuration LEGO
Introduction
Configuration supports inclusion of files to enable a modular structure.
An inclusion expression has the following format:
After inclusion the property value containing the inclusion will be replaced with the content of the include file(s).
Only files of type JSON are supported and file must contain a JSON object or array.
Syntax
An inclusion expressen MUST:
be a string (
"..."
)start with
@include:
end with a path pointing to file or directory to include
NOT contain expansions
Both files and directories can be included.
If include is a file:
Load content of file
Parse content as JSON
Replace property value with included JSON (object or array)
Including a non-existing, empty or non-json file is an error.
If include is a directory:
Create a JSON array ("result")
For each file in directory matching pattern "
*.json
"Load content of file
Parse content as JSON
Add JSON (object or array) to result array
Replace property value with result array
Including a non-existing directory is an error. Including an empty directory (or a directory that doesn't contain any .json
files) results in an empty result array.
Paths
Paths can be absolute or relative. Relative paths are resolved against the directory of the including file.
Troubleshooting
Included file/dir not found:
Included file does not contain valid JSON:
Included file is empty: