# Examples

Documentation owner: product `access`; documentation version: `next`.
Source: `content/products/access/next/configuration-reference/examples.md` at commit `eaf7a020437971baeee95e87eaf963636040ac71`.

## 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  
```

```json title="config/config.json"
{
    "globals": "@include:includes/globals.json",
    "modules": "@include:includes/modules"
}
```

```json title="config/includes/globals.json"
{
    "demo_dir": "/demo"
}
```

```json title="config/includes/modules/mod01.json"
{
    "name": "DemoModule",
    "enabled": true,
    "config": {
        "path": "${globals.demo_dir}/file01"
    }
}
```

```json title="config/includes/modules/mod02.json"
{
    "name": "DemoModule",
    "enabled": true,
    "config": {
        "path": "${globals.demo_dir}/file02"
    }
}
```

When inclusion and expansion is performed, `config.json` will have the following content:

```json
{
    "globals": {
        "base_dir": "/server"
    },
    "modules": [
        {
            "name": "DemoModule",
            "enabled": true,
            "config": {
                "path": "/demo/file01"
            }
        },
        {
            "name": "DemoModule",
            "enabled": true,
            "config": {
                "path": "/demo/file02"
            }
        }
    ]
}
```

Note that:

* `globals.json` include was expanded to an object
* `modules` include was expanded to an array containing each of the JSON files in the directory as elements
* all expansion expressions (`${globals.demo_dir}`) are replaced with the property value (`"/demo"`)
