What are the consequences of passing the `FLOWS` environment variable within node-RED to a different flows.json file?

Based on my previous query Where can I store subflow nodes with Broker / DB configuration except for `/data/flows.json` so that they show up in the Pallete?
which did not have any reply. I found a potential solution of packing my subflows with config nodes i a distinct my_flows.json with the container image and set the value of FLOWS env variable to my_flows.json

ENV FLOWS=my_flows.json

This does show my subflow nodes in the Pallete and I can see the distinct flows.json in the container with the standard empty flow

[
    {
        "id": "f6f2187d.f17ca8",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": ""
    },
    {
        "id": "3cc11d24.ff01a2",
        "type": "comment",
        "z": "f6f2187d.f17ca8",
        "name": "WARNING: please check you have started this container with a volume that is mounted to /data\\n otherwise any flow changes are lost when you redeploy or upgrade the container\\n (e.g. upgrade to a more recent node-red docker image).\\n  If you are using named volumes you can ignore this warning.\\n Double click or see info side panel to learn how to start Node-RED in Docker to save your work",
        "info": "\nTo start docker with a bind mount volume (-v option), for example:\n\n```\ndocker run -it -p 1880:1880 -v /home/user/node_red_data:/data --name mynodered nodered/node-red\n```\n\nwhere `/home/user/node_red_data` is a directory on your host machine where you want to store your flows.\n\nIf you do not do this then you can experiment and redploy flows, but if you restart or upgrade the container the flows will be disconnected and lost. \n\nThey will still exist in a hidden data volume, which can be recovered using standard docker techniques, but that is much more complex than just starting with a named volume as described above.",
        "x": 350,
        "y": 80,
        "wires": []
    }
]

what are the implications of changing the FLOWS env variable here?

The Node-RED runtime will only load one flow file at a time. If you pass a different file name using the FLOWS env var then it will just use that file.

Any changes made to the flow in the editor will be written to that file and that file only, the original flows.json will be ignored.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.