Persistent variables in NodeRed

Hello,

Is it possible to make the flow and globals persistent variables in a NodeRed program (keep value on reboot)?
I have seen some tutorial in the NodeRed documentation, with context variables but it forces to modify the settings.js file which is not in the NodeRed directory.

Working with context : Node-RED (nodered.org)
Any ideas?

Thanks.

Best reply by Sgilk

Hello,

Local file system storage is enabled on the ctrlx Node-RED distribution. Every 60s the Node-RED file context is saved to the Node-RED app data /context directory.

    contextStorage: {
        default: 'memoryOnly',
        memoryOnly: {
            module: 'memory'
        },
        file: {
            module: 'localfilesystem',
            cache: true,
            flushInterval: 60
        }
    },

 You can write values using the change node. Example below.

 

 

View original
1 reply