Hello,
I started to use environment variables to store config relating to a flow, I then duplicated the flow and changed its environment variables to customise the flow for a different environment.
For example, I have 12 environment variables to defining elements used in the office flow in my home assistant setup. I'm reusing a lot of those elements in my bedroom and have to manually recreate all 12 environment variables in the new flow.
Is there a way to export / import the environment variables from one flow to another?
It depends on where you created the env vars, how you export, what version of Node-RED etc.
In newer versions of Node-RED you can specify env vars in a group, export/import the group - job done. Also, if you add env vars in tab properties, if you export the tab, then import it, they should get imported.
I can copy a flow which includes the env variables set on its tab, but I cannot copy these env variables to another flow - only a new flow.
I tried the suggestion of creating a group with the env variables, but these are scoped to the group, so also not useful in this case.
I think I will create a single env variable that contains a json object containing all the constants I need to use. At least this can be manually copied in a single step.
Or you can put all env vars on a single tab or single group and use link-call to grab them from your "setup" tab or group and put them into msg.payload for you.