# Subflow dynamic environment variables

**URL:** https://discourse.nodered.org/t/subflow-dynamic-environment-variables/16127
**Category:** Feature Requests
**Created:** [1 October 2019 06:23 UTC](https://discourse.nodered.org/t/subflow-dynamic-environment-variables/16127 "2019-10-01T06:23:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [1 October 2019 06:23 UTC](https://discourse.nodered.org/t/subflow-dynamic-environment-variables/16127/1 "2019-10-01T06:23:58Z")

</div>

Just recently starting to look at the subflow and the environment variables, quite a sophisticated setup with a grander vision to create nodes from subflow nodes (?)

I understand that the variables are expanded upon deploying after which they are read-only, no issue there.

Is there some background thought going on to have some kind initialize routine available before variable expansion in future releases ?

Example; I am using homekit mqtt. I can query all devices from mqtt, I would like to populate a select with the data returned from the query and expand those, instead of hardcoding.

 ![15](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/4/475543129e325ff0f49f901be02800813fa99771.jpeg)

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [1 October 2019 08:16 UTC](https://discourse.nodered.org/t/subflow-dynamic-environment-variables/16127/2 "2019-10-01T08:16:51Z")

</div>

Nothing like this is currently being considered. For what you describe to work, there would have to be, at edit time, something in the runtime that is able to provide the information to the editor. But as a user creating a subflow, you don't provide any runtime code that would support this type of thing.

So whilst I can appreciate what you want to do, I don't immediately see a model that would work for subflows.

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [1 October 2019 08:42 UTC](https://discourse.nodered.org/t/subflow-dynamic-environment-variables/16127/3 "2019-10-01T08:42:51Z")

</div>

Thanks, got it. It would introduce all kinds of complexities.
