# Where can I access RED.settings?

**URL:** https://discourse.nodered.org/t/where-can-i-access-red-settings/76057
**Category:** General
**Created:** [3 March 2023 13:04 UTC](https://discourse.nodered.org/t/where-can-i-access-red-settings/76057 "2023-03-03T13:04:41Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![rmwiseman](https://avatars.discourse-cdn.com/v4/letter/r/e47c2d/32.png) [@rmwiseman](https://discourse.nodered.org/u/rmwiseman)
#### Post date: [3 March 2023 13:04 UTC](https://discourse.nodered.org/t/where-can-i-access-red-settings/76057/1 "2023-03-03T13:04:41Z")

</div>

In [this thread](https://discourse.nodered.org/t/port-red-settings-uiport-not-working/71608), @Steve-Mcl says "You do not have access to `RED.settings` in a function node." Perhaps this is a stupid question, but where in a flow _ **do** _ I have access to it? It's not in any of the dropdowns (e.g. in the CHANGE node) to allow me to access it there, so where else in a flow can I use JavaScript directly so that I can access it? Or is it perhaps only available in node definitions?

---

<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: [3 March 2023 13:13 UTC](https://discourse.nodered.org/t/where-can-i-access-red-settings/76057/2 "2023-03-03T13:13:17Z")

</div>

A flow has no access to `RED.settings`

None of the core nodes expose it in anyway and we'd strongly council against any contrib node giving access.

---

<div class="post-metadata">

### Author: ![rmwiseman](https://avatars.discourse-cdn.com/v4/letter/r/e47c2d/32.png) [@rmwiseman](https://discourse.nodered.org/u/rmwiseman)
#### Post date: [3 March 2023 13:26 UTC](https://discourse.nodered.org/t/where-can-i-access-red-settings/76057/3 "2023-03-03T13:26:39Z")

</div>

Oh. Even careful, selective, read-only access? I just want an easy way of finding out [in a flow] the host and port on which Node-RED is running without having to configure it anywhere. (It seems the `icon` URL passed to `worldmap` needs to be a full URL, not just a path.) So if I start Node-RED using `node-red -p 1881` I want to be able to retrieve 1881 from somewhere. Perhaps I'm going about this the wrong way?

---

<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 March 2023 13:54 UTC](https://discourse.nodered.org/t/where-can-i-access-red-settings/76057/4 "2023-03-03T13:54:39Z")

</div>

Read-only access from a custom node is OK. But access from a flow is not so good because it collapses the separation of concerns. The settings.js may contain information that users should not have access to even to read. Use with caution.

The best way to safely share such things with flows is to add them as global variables in settings.js itself. Just make sure that whatever you share, you don't mind sharing with anyone who has access to the Editor.

---

<div class="post-metadata">

### Author: ![rmwiseman](https://avatars.discourse-cdn.com/v4/letter/r/e47c2d/32.png) [@rmwiseman](https://discourse.nodered.org/u/rmwiseman)
#### Post date: [3 March 2023 14:07 UTC](https://discourse.nodered.org/t/where-can-i-access-red-settings/76057/5 "2023-03-03T14:07:47Z")

</div>

Thanks. It's a shame I have to provide a full icon URL to the `worldmap`, really, as that's where this all started! I've just implemented an even worse approach than creating a custom node, if you can believe that (don't ask) but I dislike it so much I think I'll undo it and find something more dependable.

I appreciate the thoughts, @TotallyInformation and @knolleary.

---

<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 March 2023 17:20 UTC](https://discourse.nodered.org/t/where-can-i-access-red-settings/76057/6 "2023-03-03T17:20:27Z")

</div>

> [@rmwiseman](#):
>
> Thanks. It's a shame I have to provide a full icon URL to the `worldmap`, really, as that's where this all started! I've just implemented an even worse approach than creating a custom node, if you can believe that (don't ask) but I dislike it so much I think I'll undo it and find something more dependable.

Adding the setting to your globals is easy enough and is fine if that is the need. It is a common enough need to provide access to things like the Node-RED port number. Of course, there is an alternative that is much better for end users and that is to use a reverse proxy to hide the port number and ip address completely. Use an ip name with the default ports (443 for https hopefully) and shift things onto paths as needed. Not terribly hard to do and will even still run on a Pi as long as you don't go mad with the flows and number of users. There are plenty of examples shared in the forum.

---

<div class="post-metadata">

### Author: ![rmwiseman](https://avatars.discourse-cdn.com/v4/letter/r/e47c2d/32.png) [@rmwiseman](https://discourse.nodered.org/u/rmwiseman)
#### Post date: [21 March 2023 16:10 UTC](https://discourse.nodered.org/t/where-can-i-access-red-settings/76057/7 "2023-03-21T16:10:48Z")

</div>

In case anyone else wants to use Node-RED to serve up icons used in `worldmap`, my pull request to **Let icon "url" be a local fixed path** was included in v2.34.0.

---

<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: [20 May 2023 16:11 UTC](https://discourse.nodered.org/t/where-can-i-access-red-settings/76057/8 "2023-05-20T16:11:38Z")

</div>

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