Handling of environment variables locally and in Docker


I have a setup that looks like this:

  1. I develop locally using Node red (npm start etc)
  2. I have build scripts that can build these files as docker containers that can be deployed in other environments

The problem I have is now to handle environment variables in this setup (like IP-numbers of databases, and secrets like database usernames/passwords ).

I'd like to use environment variable files that I can use the --env-file in docker to pickup the config files (and handle those locally outside of the container) but how can I get this to be a good workflow with developing locally using the NPM-approach (1)?

Kind regards

Hi, this is really more of a docker management question than node-red to be fair however, have you considered using something pre-built for this level of control & management? For example, with FlowForge you can set up multiple projects that can be deployed to remote devices and have their own environment variables all from within the FlowForge web editor. FlowForge is open source & can be installed to use local filesystem, docker or k8s.

For full disclosure, I work for FlowForge (and I think it is fantastic :wink:)

PS: Please feel free to ignore this response and continue to progress your own solution - I just figured you may not have been aware of other options.

How/Where do you want to use the env variables? Node-RED has pretty good built-in support and I responded to a question on this just a few days ago.

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