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