# Handling of environment variables locally and in Docker

**URL:** <https://discourse.nodered.org/t/handling-of-environment-variables-locally-and-in-docker/77300>\
**Category:** General\
**Tags:** docker\
**Created:** [6 April 2023 07:04 UTC](https://discourse.nodered.org/t/handling-of-environment-variables-locally-and-in-docker/77300 "2023-04-06T07:04:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![flipzz](https://avatars.discourse-cdn.com/v4/letter/f/bb73d2/32.png) [@flipzz](https://discourse.nodered.org/u/flipzz)\
**Post date:** [6 April 2023 07:04 UTC](https://discourse.nodered.org/t/handling-of-environment-variables-locally-and-in-docker/77300/1 "2023-04-06T07:04:08Z")

</div>

Hi,

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

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 April 2023 07:23 UTC](https://discourse.nodered.org/t/handling-of-environment-variables-locally-and-in-docker/77300/2 "2023-04-06T07:23:50Z")

</div>

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 😉)

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.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [6 April 2023 08:11 UTC](https://discourse.nodered.org/t/handling-of-environment-variables-locally-and-in-docker/77300/3 "2023-04-06T08:11:38Z")

</div>

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

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [5 June 2023 08:12 UTC](https://discourse.nodered.org/t/handling-of-environment-variables-locally-and-in-docker/77300/4 "2023-06-05T08:12:34Z")

</div>

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