I am trying to get the active node-RED port in a function node. I read a lot of topics about this, but in my case this doesn't seem to work.
In my settings file, it looks like this:
When I make a statement like this in a function node,
let port_nodered = RED.settings.uiPort;
I get this report:
You do not have access to RED.settings
in a function node.
You could access env.get('PORT')
in a function
So assuming you wanted port 2828
, then you could either ...
- set
PORT
as an environment variable before launching node-red (preferred / more portable)
OR
- in the settings file, above
module.exports = {
, put process.env.PORT = 2828
1 Like
@Steve-Mcl I put in the settings file, as you suggested. And it is working, thanks very much !!!
system
Closed
4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.