OnnoH
August 23, 2025, 2:11pm
1
Hi All,
I’ve created a menu plugin (following the example on camunda-modeler-plugins/menu-plugin-example at main · camunda/camunda-modeler-plugins · GitHub ) with a configuration overlay (based on this auto-save plugin GitHub - pinussilvestrus/camunda-modeler-autosave-plugin: Automatically save your diagrams modeled in Camunda Modeler ).
Both work fine on their own, but I want to combine the two.
How can I get access to the configuration from the menu plugin? In the example code, electronApp and menuState are injected, but neither do carry the config afaik.
Thanks for any advice.
OnnoH
September 1, 2025, 6:27am
2
To answer my own question by means of a workaround:
const path = require('path');
const fs = require('fs');
const CLIENT_CONFIG_FILE = 'config.json';
const CONFIG_FILE_ENCODING = 'utf8';
const userDataPath = electronApp.getPath('userData');
export function getPluginConfig(userDataPath) {
const config = JSON.parse(
fs.readFileSync(
path.join(userData, CLIENT_CONFIG_FILE),
CONFIG_FILE_ENCODING
)
);
let pluginConfig = config.plugins?.pluginName?.clientConfig;
if (!pluginConfig) {
pluginConfig = {
enabled: false,
url: '',
user: {},
};
}
return pluginConfig;
}