Port number of running node-red instance

In a node you should be able to access RED.settings.port.