Examples
Example configuration snippets
Demo configuration with inclusion and expansion
Assume the following directories/files:
/
+ server/
+ config/
+ config.json
+ includes/
+ globals.json
+ modules/
+ mod01.json
+ mod02.json
+ demo/
+ file01
+ file02 {
"globals": "@include:includes/globals.json",
"modules": "@include:includes/modules"
}{
"demo_dir": "/demo"
}{
"name": "DemoModule",
"enabled": true,
"config": {
"path": "${globals.demo_dir}/file01"
}
}{
"name": "DemoModule",
"enabled": true,
"config": {
"path": "${globals.demo_dir}/file02"
}
}When inclusion and expansion is performed, config.json will have the following content:
{
"globals": {
"base_dir": "/server"
},
"modules": [
{
"name": "DemoModule",
"enabled": true,
"config": {
"path": "/demo/file01"
}
},
{
"name": "DemoModule",
"enabled": true,
"config": {
"path": "/demo/file02"
}
}
]
}Note that:
globals.jsoninclude was expanded to an objectmodulesinclude was expanded to an array containing each of the JSON files in the directory as elementsall expansion expressions (
${globals.demo_dir}) are replaced with the property value ("/demo")
