node-red-contrib-config is a Node-RED node designed for managing and setting flow and global context variables. It allows developers to define configuration values in a centralized location within their Node-RED flows and apply them either during the Node-RED startup phase (initialization) or dynamically at runtime through messages or manual triggers. This enables robust management of application state and parameters, supporting scenarios where configuration needs to be altered programmatically or manually without redeploying entire flows. The current stable version is 1.2.2, with releases occurring periodically based on feature enhancements and bug fixes rather than a strict schedule. Its key differentiator lies in providing a dedicated, visual mechanism within the Node-RED environment for both initial and dynamic context variable management, serving as an important tool for maintaining consistent application settings across complex deployments.
npm install node-red-contrib-configVerified import paths — ran on the pinned version, not inferred.
This Node-RED flow demonstrates how to use the `config` node to set a global context variable ('PC_Stability') at startup, manually via node buttons, and programmatically via incoming messages. Debug nodes display the updated context value.
Always explicitly define context scope (e.g., `global.yourKey` for global, `flow.yourKey` for flow-specific) in the 'Property' field of the `config` node.
Review and configure your Node-RED `settings.js` for desired context persistence, especially if relying on 'Active' startup configuration across restarts. See Node-RED documentation on 'Context' and 'Storage'.
If immediate usage of newly applied context values is critical in the same flow path, consider adding a small `delay` node (e.g., 150ms) after the 'config' node's output to ensure context is updated before consumption by downstream nodes.
Always use `global.get('myVar')`, `global.set('myVar', value)`, `flow.get('myVar')`, or `flow.set('myVar', value)` to access and modify context variables programmatically within function nodes.Ensure you are in the Node-RED user directory (e.g., `~/.node-red`) and run `npm install node-red-contrib-config`, then restart Node-RED to load the new nodes into the palette.
Verify the 'Property' field uses `global.yourKey` or `flow.yourKey` correctly. For timing, consider adding a short `delay` node after the 'config' node's output. Ensure the 'Active' checkbox is ticked if you expect configuration to apply at startup.
Edit your Node-RED `settings.js` file and configure `contextStorage` to use a persistent store like `localfilesystem` or another suitable option for your environment.
No dependency data recorded yet.