Signal K
    Preparing search index...

    Plugin Configuration

    A plugin's schema function must return a JSON Schema object describing the structure of the configuration data.

    Example:

    plugin.schema = {
    type: 'object',
    required: ['some_string', 'some_other_number'],
    properties: {
    some_string: {
    type: 'string',
    title: 'Some string that the plugin needs'
    },
    some_number: {
    type: 'number',
    title: 'Some number that the plugin needs',
    default: 60
    },
    some_other_number: {
    type: 'number',
    title: 'Some other number that the plugin needs',
    default: 5
    }
    }
    }

    JSON Schema approach works reasonably well for simple to medium complex configuration data. The server supports also custom plugin configuration components, bypassing the automatic configuration format generation.

    It should be noted that some JSON schema constructs are not supported. Refer to the RJSF documentation for details.

    The configuration data is stored by the server under the following path $SIGNALK_NODE_CONFIG_DIR/plugin-config-data/<plugin-name>.json. (Default value of SIGNALK_NODE_CONFIG_DIR is $HOME/.signalk.)

    The plugin is passed the configuration settings as the first parameter of the start function.

    plugin.start = (settings, restartPlugin) => {
    // settings contains the plugin configuration
    ...
    }

    The plugin can define uiSchema by returning a uiSchema object which is used to control how the user interface is rendered in the Admin UI.

    Example: Make all data in an object called 'myObject' collapsible:

    uiSchema['myObject'] = {
    'ui:field': 'collapsible',
    collapse: {
    field: 'ObjectField',
    wrapClassName: 'panel-group'
    }
    }

    For more information, see react-jsonschema-form-extras

    If your plugin does not require any initial configuration, you can enable it to start when the Signal K server is restarted after the plugin is installed.

    To do this add the following to the package.json:

      "signalk-plugin-enabled-by-default": true