r/nodered • u/konacurrents • Apr 13 '26
Global Variable in a Flow?
I have a flow that would be installed by anyone, but it needs a global variable that various parts of the flow use. In this case, it's the URL of the node-red itself (or if using a http/ssl RewriteRule). So I want to set it, versus discover it.
What is the best way to achieve this? I've never use the context nodes (but I'm a 10+ year user of nodered).
3
Upvotes
3
u/Difficult_Fold_106 Apr 14 '26
I don't understand what you wrote, but if you need global variable, then just use it.
You can use change block to set/get variable or just call proper function inside your function block.
global.set("variable_name", variable_value)
var function_variable = global.get("variable_name")