Enabling nodes automatically for double environment

I am using a separate development and live node-red environment, so that i can work in the development environment without loosing uptime and input messages. Every time i am upgrading the live environment to the newest working development environment i have to enable/disable nodes and change credentials manually so that msg are not double received or connections are not lost (do to double envirenments). I now put all inputs double in the node red environment and disable the ones that are needed in a certain environment. I do this by hand, which costs time and is prone to errors. Is there a way that i am able to automate the enabling/disabling of nodes depending on the environment. I know in which environment the code is running.
Switching after the input does not work, due to a double connection where the credentials can only be used once. Switching also causes loss of resources which are not needed.
For now i am enabling/disabling mqtt nodes (both input and output), https in, timestamps running repeatedly, udp in and tcp in.