# Is there a way to set the usename of mqtt dynamically

**URL:** <https://discourse.nodered.org/t/is-there-a-way-to-set-the-usename-of-mqtt-dynamically/1215>\
**Category:** General\
**Created:** [1 July 2018 02:58 UTC](https://discourse.nodered.org/t/is-there-a-way-to-set-the-usename-of-mqtt-dynamically/1215 "2018-07-01T02:58:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dilepa](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@dilepa](https://discourse.nodered.org/u/dilepa)\
**Post date:** [1 July 2018 02:58 UTC](https://discourse.nodered.org/t/is-there-a-way-to-set-the-usename-of-mqtt-dynamically/1215/1 "2018-07-01T02:58:05Z")

</div>

I want to set the mqtt username dynamically using the default node red mqtt node? Any hits as to how i can do it?

Thanks

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [1 July 2018 07:48 UTC](https://discourse.nodered.org/t/is-there-a-way-to-set-the-usename-of-mqtt-dynamically/1215/2 "2018-07-01T07:48:02Z")

</div>

Not dynamically no - but you can set it using an environment variable at start time using the `$(MY_ENV_VAR)` syntax in the field to read `MY_ENV_VAR`

---

<div class="post-metadata">

**Author:** ![dilepa](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@dilepa](https://discourse.nodered.org/u/dilepa)\
**Post date:** [1 July 2018 08:27 UTC](https://discourse.nodered.org/t/is-there-a-way-to-set-the-usename-of-mqtt-dynamically/1215/3 "2018-07-01T08:27:22Z")

</div>

Thanks, will check it out.
