trunk-recorder icon indicating copy to clipboard operation
trunk-recorder copied to clipboard

Avoid loading unused internal plugins

Open taclane opened this issue 3 months ago • 1 comments

The four "internal" plugins [openmhz_uploader, broadcastify_uploader, stat_socket, unit_script] are always loaded, whether or not the user intends to use them in their trunk-recorder installation.

After the configuration file is parsed, this PR checks if any of the mandatory configuration keys for the above plugins are present before adding them to the load list. This will reduce unnecessary API calls, and avoid the overhead of loading a plugin in duplicate should the user consolidate the configuration into the "plugins" section as shown in the example below:

    "plugins": [
        {
            "name": "Broadcastify",
            "library": "libbroadcastify_uploader.so",
            "enabled": true,
            "broadcastifyCallsServer": "https://api.broadcastify.com/call-upload",
            "broadcastifySslVerifyDisable": false,
            "systems": [
                {
                    "shortName": "sys1",
                    "broadcastifySystemId": 1234,
                    "broadcastifyApiKey": "api-key-vrry-secret"
                },
                {
                    "shortName": "sys2",
                    "broadcastifySystemId": 1235,
                    "broadcastifyApiKey": "api-key-vrry-secret"
                }
            ]
        }
    ]

"Internal" plugins (other than stat_socket) can be loaded in "plugin" section if desired. Aside from the convenience of managing a plugin's configuration in a single part of the config file, this also allows the user to toggle the enabled key to easily enable/disable a plugin as needed.

taclane avatar Apr 19 '24 15:04 taclane