# Using environment variable as password for "MQTT in" node

**URL:** <https://discourse.nodered.org/t/using-environment-variable-as-password-for-mqtt-in-node/26318>\
**Category:** General\
**Created:** [8 May 2020 16:20 UTC](https://discourse.nodered.org/t/using-environment-variable-as-password-for-mqtt-in-node/26318 "2020-05-08T16:20:50Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [8 May 2020 16:28 UTC](https://discourse.nodered.org/t/using-environment-variable-as-password-for-mqtt-in-node/26318/2 "2020-05-08T16:28:45Z")

</div>

A search of the forum shows this...

> [@MQTT configuration from file or env. variable](https://discourse.nodered.org/t/mqtt-configuration-from-file-or-env-variable/11617/4):
>
> Hi @Chris24918 you can do this using environment variables. Any node property can be set to something like $(MY\_CLIENT\_ID) and the runtime will substitute the value of the env var MY\_CLIENT\_ID before it gets passed to the node. This cannot be used to insert env vars into part of the value - it has to be the entire value - so $(MY\_CLIENT\_ID)\_FOO will not work. That is exactly what you want if you are deploying the same set of flows to 50+ devices and you need each to insert its own configurati…

> [@Myzhar](#):
>
> but it seems like if the environment variable is not resolved and the node applies the exact chars entered in the form field as password

Are you saying it works OK if the env var IS created (but uses the `$(xxx)` if its not defined)?

In which case - is that a problem?

---

_[View the full topic](https://discourse.nodered.org/t/using-environment-variable-as-password-for-mqtt-in-node/26318)._
