# How to change node settings in one place

**URL:** <https://discourse.nodered.org/t/how-to-change-node-settings-in-one-place/17457>\
**Category:** General\
**Created:** [3 November 2019 10:16 UTC](https://discourse.nodered.org/t/how-to-change-node-settings-in-one-place/17457 "2019-11-03T10:16:51Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![tb19-nr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tb19-nr/32/19004_2.png) [@tb19-nr](https://discourse.nodered.org/u/tb19-nr)\
**Post date:** [3 November 2019 10:16 UTC](https://discourse.nodered.org/t/how-to-change-node-settings-in-one-place/17457/1 "2019-11-03T10:16:51Z")

</div>

Hi folks,

I'm into node-red for some weeks now and one problem keeps coming up again and again for me.  
I have a dozen sequences and multiple flows/tabs and the nodes in there shall rely on specific settings I want to maintain in a single place (or for each flow/tab separately).

So I like to set the email server, mqtt-prefixes, watch folder paths, http-endpoint uris etc. in a dedicated "config" location and pick bits out of the config via function node e.g., but most nodes do not seem to support injecting required properties via msg (which I use whenever possible). I even went as far as writing a custom "watch" node, which is able to be read folder-paths to watch at from msg.filepath, but I obviously cannot come up with custom nodes for all the native nodes in node-red just to make configuration possible.

What I am basically looking for is something like this:

- inject object like **{ myProject : { emailserver : "[mymail.com](http://mymail.com)" }}** into global **context** at flow startup.  
(I seem to have accomplished this with "node-red-contrib-config" at least.)
- enter **{global['myProject.emailserver']}** as "Server" value in the email-node editor (e.g.)  
(This would also avoid "useless" setup/change/function nodes on front of many nodes.)

Is there something like this?  
Thank you! o)

ps: I've seen that you can use ENV vars like this, but maintaining ENV vars for the project externally is not really the way to go in my opinion and I have hundreds of configurable items (ip-cameras, ip-addresses, folders, etc). I cannot list or edit ENV vars from within the node-red environment in a "settings-container" like fashion easily either.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [3 November 2019 10:29 UTC](https://discourse.nodered.org/t/how-to-change-node-settings-in-one-place/17457/2 "2019-11-03T10:29:20Z")

</div>

You can do the first part using an object node and the basic change node where you can set  
a global variable to be an object. No need for any contrib nodes

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [3 November 2019 10:36 UTC](https://discourse.nodered.org/t/how-to-change-node-settings-in-one-place/17457/3 "2019-11-03T10:36:23Z")

</div>

This is exctly what I use global contect variables for. You have tab 1 (I rename the tab to 'Initialize') the place you set the variables and then the other tabs can grab the values when they need to use them.

---

<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:** [3 November 2019 13:44 UTC](https://discourse.nodered.org/t/how-to-change-node-settings-in-one-place/17457/4 "2019-11-03T13:44:39Z")

</div>

If you really do mean you want to do it at startup time - then you can use environment variables - [https://nodered.org/docs/user-guide/environment-variables](https://nodered.org/docs/user-guide/environment-variables)

---

<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:** [3 November 2019 14:40 UTC](https://discourse.nodered.org/t/how-to-change-node-settings-in-one-place/17457/5 "2019-11-03T14:40:36Z")

</div>

Or in the globals section of the settings.js file. To make management easier, you can leverage the node.js modules feature to create your own single-file module that you can then require into the globals. That way you can keep your own settings in your own file.

---

<div class="post-metadata">

**Author:** ![tb19-nr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tb19-nr/32/19004_2.png) [@tb19-nr](https://discourse.nodered.org/u/tb19-nr)\
**Post date:** [4 November 2019 18:02 UTC](https://discourse.nodered.org/t/how-to-change-node-settings-in-one-place/17457/6 "2019-11-04T18:02:51Z")

</div>

Hello guys, thank you for helping out! o)

First point is kinda solved with " **node-red-contrib-config**"? Let me quote from its page ([https://flows.nodered.org/node/node-red-contrib-config](https://flows.nodered.org/node/node-red-contrib-config)):

> If the Config node is Active, the configuration properties will be **applied at startup before any flows** are started.

Having the settings ready before the flows start is quite important, I was just looking for an alternative to the contrib node. Using settings.js is difficult, settings in there do not export well together with the flows.

* * *

Regarding 2) Any ideas here? **This is the real difficulty**. How to supply settings to nodes, which do not support incoming msg. As mentioned, I had hopes to be able to use the node editor with some curly-bracket syntax or something to inject settings, like it's possible with ENV vars.

---

<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:** [4 November 2019 18:45 UTC](https://discourse.nodered.org/t/how-to-change-node-settings-in-one-place/17457/7 "2019-11-04T18:45:26Z")

</div>

> [@tb19-nr](#):
>
> Regarding 2) Any ideas here? **This is the real difficulty**. How to supply settings to nodes, which do not support incoming msg.

Today, env var are the only option available to do this sort of thing.

As of 1.0, it is possible to define and manage env vars within a subflow, but not generally.

There are some thoughts about adding something to the projects feature to make it possible to manage settings for different environments. But they are only thoughts and there's no specific plan to deliver it.

---

<div class="post-metadata">

**Author:** ![tb19-nr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tb19-nr/32/19004_2.png) [@tb19-nr](https://discourse.nodered.org/u/tb19-nr)\
**Post date:** [13 March 2025 11:50 UTC](https://discourse.nodered.org/t/how-to-change-node-settings-in-one-place/17457/8 "2025-03-13T11:50:54Z")

</div>

Regarding my point 2, "How to supply settings to nodes directly in the node editor input?"

**Is there a way to get an expression working like shown below in recent NR versions (v4 and up)?**

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bdb76109b54cc27a40edffe8d3233ba3c3d2a86f.png)

I created a topic regarding this "expression" type of syntax in node editors, not much response back then.

> [@Support ${msg.foobar} for dynamic input in node editor](https://discourse.nodered.org/t/support-msg-foobar-for-dynamic-input-in-node-editor/17500):
>
> Hey Guys! o) It seems we can use env vars to set node-properties, like described here: [[https://github.com/node-red/node-red/wiki/Design%3A-Using-environment-variables](https://github.com/node-red/node-red/wiki/Design%3A-Using-environment-variables)] Nice, but ENV vars only? Wot? o) Aren't global/flow context vars and message objects the first class citizens in node-red? In my flows I'd like to configure node settings in one place, like email-hostnames, mqtt-prefixes, ip-addresses, filesystem-paths etc. Right now I need to pick dozens of nodes and edit them manually afte…

I also read about JSONata support in more recent versions, but failed to find a single example in the docs and this forum about where these **JSONata expressions can be used and IF they can be used in any node editor (which would solve my problem!)**.

Thank you! o)

ps: Side topic question:  
What does "Environment Variable" mean in Node-Red context? An "Environment Variable" for me, is something I set on OS or process level, like "PATH". Is this the kind of variables Node-Red is talking about, when it says "environment variable" in the docs or is it referring to some javascript / nodejs / flow context variables? I don't get it! o)

---

<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:** [13 March 2025 17:25 UTC](https://discourse.nodered.org/t/how-to-change-node-settings-in-one-place/17457/9 "2025-03-13T17:25:21Z")

</div>

> [@tb19-nr](#):
>
> Is there a way to get an expression working like shown below in recent NR versions (v4 and up)?

Not that I know of. You might though be able to do something with Node-RED's pseudo env vars - in a group box for example. Not sure.

> [@tb19-nr](#):
>
> I created a topic regarding this "expression" type of syntax in node editors, not much response back then.

Node-RED has the Typed Input control available to Nodes in the Editor which includes options to use JSONata which can do complex expressions. Other inputs can do deep object selections.

> [@tb19-nr](#):
>
> but failed to find a single example in the docs and this forum about where these **JSONata expressions can be used and IF they can be used in any node editor (which would solve my problem!)**.

JSONata inputs have to be built into a nodes editor panel. However, you can also use it in a function node if needed (though often easier to simply use JavaScript in that case).

The core change node, has typed inputs and so is a generic way to potentially do what you want.

---

<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:** [13 March 2025 17:28 UTC](https://discourse.nodered.org/t/how-to-change-node-settings-in-one-place/17457/10 "2025-03-13T17:28:30Z")

</div>

> [@tb19-nr](#):
>
> What does "Environment Variable" mean in Node-Red context? An "Environment Variable" for me, is something I set on OS or process level, like "PATH". Is this the kind of variables Node-Red is talking about, when it says "environment variable" in the docs or is it referring to some javascript / nodejs / flow context variables? I don't get it! o)

Environment Variables do indeed normally refer to something at the OS level. Such variables, when used in an application like Node-RED are invariant between start-ups.

But Node-RED has something else called Environment Variables as well. While somewhat confusing, I believe they are named that way because you use them in flows in the same way as OS env vars.

This 2nd type are set in flow tabs, groups and sub-flows and can be consumed within the structure that defines them.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [13 March 2025 18:49 UTC](https://discourse.nodered.org/t/how-to-change-node-settings-in-one-place/17457/11 "2025-03-13T18:49:10Z")

</div>

You could set the environment variable to a single string

```auto
JSONVAR='{"foo": 101, "bar": 55}'

```

and in Node-red read the variable, pass it through a json parse node and save it to a global context variable,

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/2/b2998d70da00950f27d53d06da2c2864a73a2266.png)
