Continuing the discussion from Port number of running node-red instance:
@knolleary you mentioned that the admin port was available using
RED.settings.port
Following on from the suggested solution in the linked post, in a function node if I type msg.payload = RED.settings.uiPort;
the response is that settings is undefined.
Hence my original question, is this no longer a valid solution?
Is RED.settings.uiPort available in function node or only in a custom node?
In our version (3.0.2) I exported 'RED' to message.payload in order to see what was there (passed it to a debug node).
i.e. msg.payload = RED;
I don't know if this is a valid approach but it returned the following:
util>
encodeObject: function
ensureString: function
ensureBuffer: function
cloneMessage: function
compareObjects: function
generateId: function
getMessageProperty: function
setMessageProperty: function
getObjectProperty: function
setObjectProperty: function
evaluateNodeProperty: function
normalisePropertyExpression: function
normaliseNodeTypeName: function
prepareJSONataExpression: function
evaluateJSONataExpression: function
parseContextStore: function
getSetting: function
For context we have a subflow who's job is to restart all flows in the case of a catastrophic failure. Originally we had the port hard coded. Found the linked thread (above) to determine the admin port.
We will likely go down the path of adding the port as a variable to global (the other solutions documented in the original thread), this will of course preclude the use of -p in the command line but I think we can live with that.
Appreciate any advice.
Rob