Hello, I created a custom node, but I don't know how to access environment variables in the custom node
pls help, thanks!
Hello, I created a custom node, but I don't know how to access environment variables in the custom node
pls help, thanks!
You can use:
RED.util.getSetting(node, 'ENV_VAR')
Thanks! This helped. Where is the documentation for this?
I thought it was covered in Using environment variables : Node-RED - but that is more end-user facing docs.
We should add something to JavaScript file : Node-RED
Is there a difference to process.env['ENV_VAR']
... for a custom node?
Within Node-RED, you can set properties that are scoped to individual subflows or flows. They show up as env vars to the nodes - as long as they use RED.util.getSetting(node, 'ENV_VAR')
. This is why the call includes the node object - so the runtime can look up the right value for that particular node depending on what flow/subflow its in.
Thank you for this explanation!
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.