Configuration

Preferences

To change the default settings of BrainD, the desktop application provides a simple dialog window that enables users to change the HTTP server settings and specify SSL/TLS Certificates. To open the dialog, click on the taskbar menu and select “Preferences”.

The following diagram lists the available configuration options in the Settings dialog:

../../_images/controlroom-preferences.png
Preferences Details

Item

Description

A

Default server address. Default is 127.0.0.1, which will allow connection from external devices.

B

Enable SSL/TLS on client connections.

C

Restore configuration settings to factory defaults.

D

Close the preferences window without saving.

E

Optional path to a JSON Configuration File.

F

Server port to bind to for clients. Default is 9005.

G

SSL/TLS Certificate (.crt) file. If not specified, a self-signed cert will be generated.

H

SSL/TLS Key (.key) file. If not specified, a self-signed cert will be generated.

I

Save application settings.

Configuration Files

BrainD allows for more fine-grained control of the backend service through the use of JSON configuration files. This configuration includes settings for logging, polling rates, and web server configuration.

The BrainD service will read the following configuration file for the current operating system:

  1. Windows: %AppData%\Acroname\BrainD\config\config.json

  2. Mac: ~/Library/Application Support/Acroname/BrainD/config/config.json

  3. Linux: ~/.acroname/BrainD/config/config.json

Each entry in the config.json file will be merged into the default configuration object, overriding each field that is listed. In addition, if any configuration files are specified in the “Config File(s)” entry of the Settings menu, these files will be read and merged as well. The default configuration object is defined as the following:

{
    "logging": {
        "loggers": {
            "default": "debug"
        },
        "sinks": {
            "consoleSinks": [
                {
                    "enable": true,
                    "level": "debug",
                    "enableColors": true,
                    "colorPattern": "\u001B[0m[\u001B[32m%Y-%m-%d %H:%M:%S.%e\u001B[0m] [%^%l%$] [\u001B[35m%n\u001B[0m:\u001B[33m%#\u001B[0m] %v",
                    "noColorPattern": "[%Y-%m-%d %H:%M:%S] [%l] [%n:%#] %v"
                }
            ],
            "fileSinks": [
                {
                    "enable": true,
                    "level": "info",
                    "pattern": "[%Y-%m-%d %H:%M:%S] [%l] [%n:%#] %v",
                    "path": {
                        "win": "%AppData%\\Acroname\\BrainD\\log",
                        "mac": "~/Library/Logs/Acroname/BrainD",
                        "lin": "~/.acroname/BrainD/log"
                    },
                    "baseFileName": "braind.log",
                    "maxFiles": 5,
                    "maxFileSize": 5242880
                }
            ]
        },
        "flushInterval": 3000
    },
    "httpServer": {
        "enable": false,
        "address": "0.0.0.0",
        "port": 9005,
        "threadCount": 1
    },
    "httpsServer": {
        "enable": true,
        "address": "0.0.0.0",
        "port": 9006,
        "threadCount": 1,
        "sslCert": "",
        "sslKey": ""
    },
    "pollingRates": {
        "acronameDevicesState": 300,
        "devices": 300,
        "brainstem": 1000
    }
}

Note

The config['httpServer'] and config['httpsServer'] configuration objects will have no effect if the BrainD desktop application is used. The value in the Settings dialog takes priority.

Examples

Add an additional log file output:

{
    "logging": {
        "sinks": {
            "fileSinks": [
                {
                    "enable": true,
                    "level": "info",
                    "pattern": "[%Y-%m-%d %H:%M:%S] [%l] [%n:%#] %v",
                    "path": {
                        "win": "C:\\Users\\username\\Desktop",
                        "mac": "~/Desktop",
                        "lin": "~/Desktop"
                    },
                    "baseFileName": "custom-log-file.log"
                }
            ]
        }
    }
}

Increase the log flush rate from 3000ms to 500ms, and reduce the USB tree polling rate from 300ms to 1000ms:

{
    "logging": {
        "flushInterval": 3000
    },
    "pollingRates": {
        "devices": 1000
    }
}