# Configuration ecosystem

ApertusVR can be configured by JSON config fiiles. _ApeSystem.json_ contains settings for **ApertusCore** and beside that, each **ApertusPlugin** is configurable by its own JSON config file.

ApertusVR **Samples** (applications) can also manage multiple, separated configurations. For more details, please check the example below.

## Example

### Relative configs folder

If you would like to have your _configs_ folder next to your application executable (_ApeHelloWorld_), just rewrite line 30 in samples/helloWorld/ApeHelloWorld.cpp

```
configDir << APE_SOURCE_DIR << "/samples/helloWorld/configs/";
```

to

```
configDir << "configs/";
```

In this scenario, you can start _ApeHelloWorld_ application in 2 ways:

#### Option A

If you run it without any arguments, and it will display a list of configuration options ( folders inside configs folder, i.e. local\_monitor ) which you can select in terminal to start.

#### Option B

If you would like to start the application with a specific configuration, then start _ApeHelloWorld_ as:

```
> ApeHelloWorld -c [config_folder_name]
```

### Absolute configs folder

If you would like to have your _configs_ folders anywhere else (not relative to your ApeHelloWorld executable), just remove line 30 in samples/helloWorld/ApeHelloWorld.cpp:

```
configDir << APE_SOURCE_DIR << "/samples/helloWorld/configs/";
```

If you have your configs folder in \~/path/to/configs, then you can start ApeHelloWorld as:

```
> ApeHelloWorld -c ~/path/to/configs
```



## Configuration files

### ApeSystem.json

```
{
    "mainWindow": {
        "name": "Ape",
        "creator": "ApeOgreRenderPlugin"
    },
    "sceneSession": {
        "participantType": "Local",
        "uniqueUserNamePrefix": "",
        "sessionGUID": "",
        "sessionResourceLocation": [
            "/plugins/helloWorld/resources"
        ],
        "natPunchThroughServer": {
            "ip": "",
            "port": ""
        },
        "lobbyServer": {
            "useLobby": false,
            "ip": "",
            "port": "",
            "sessionName": "test"
        }
    },
    "pluginManager": {
        "plugins": [
            "ApeOgreRenderPlugin",
            "ApeOisUserInputPlugin",
            "ApeHelloWorldPlugin"
        ]
    }
}
```

As you can see, there are three objects: _mainWindow_, _sceneSession_, and _pluginManager_.

### MainWindow object

```
"mainWindow": {
    "name": "Ape",
    "creator": "ApeOgreRenderPlugin"
}
```

The _name_ key is the name of the Window.\
The _creator_ key is the name of the plugin which is going to make the window.

### _SceneSession object_

_Coming soon._

### _PluginManager object_

```
"pluginManager": {
    "plugins": [
        "ApeOgreRenderPlugin",
        "ApeOisUserInputPlugin",
        "ApeHelloWorldPlugin"
    ]
}
```

The _plugins_ object defines an array of plugin names. These plugins will be started on the initialization of  ApertusVR.
