Use Environment Variables As Config Substitute

Hello,

I have many instances where I manage quite a few NodeRED instances deployed via Docker. For a variety of reasons, it would be extremely useful to be able to adjust the settings in settings.js via env variables so I don't need to touch every file on deploy. For example, setting the credentialSecret value.

Would the project be willing to accept a PR that would essentially follow the Grafana methodology that gets expanded on deploy. See Configure Grafana | Grafana documentation for the general idea.

My proposal would essentially be to have any variable prepended with NODE_RED_ (or other), followed by the object path. All in all, the code changes would be mostly adding a loop with the variables expanded into the config using something similar to Lodash Documentation.

I've looked at the current options (especially outlined in here: Use of environment variables to set editor user name and password) however I'd like to have something a bit more generic.

Is this something worth pursuing or are there considerations that I'm not seeing?

Without knowing the reasons behind the choice of docker, have you looked at FlowFuse

Indeed we have! I have spent some time with local installations over the last few weeks and there's a couple of key requirements that would likely make the instance vs device distinction not workable. For the most part, our deploys are a ton of bespoke instances, nothing that would be "Deploy 10 copies of this flow".

My own installs of Node-RED all have far more extensive env overrides than the default. Much of that is available on github - look for my alternate installer repo.

That also has a comprehensive systemd script that includes the option to use a local env file on startup. A great way to control the settings. Especially if, like me, you use local Node-RED installs instead of global.

This is very similar to what I've done in the past but I've been shying away from having customized packages of things to avoid having documentation/processes bifurcated. I'm trying to spend that time seeing if I can contribute to projects so others can use them. This one strikes me as a good fit since there is a lot of discussion around Grafana and graphing related to Node-RED and the folks over at Grafana set a nice precedent for it.