Hi,
Another quick obscure question (Sorry!) Is it possible to access the settings (from settings.js) in a function node?
I am trying to use the httpAdmin api to get current list of flows and I need the port for the URL.
Thanks
Hi,
Another quick obscure question (Sorry!) Is it possible to access the settings (from settings.js) in a function node?
I am trying to use the httpAdmin api to get current list of flows and I need the port for the URL.
Thanks
You need the port to interact with the API. You can ofcourse grep the port from the file directly, eg;
grep -i uiport settings.js
Thanks for the suggestion. Does this mean the settings are not exposed to function nodes?
Env variables are. So you could set PORT
before you launch node-red then it will run on that PORT and you can access it via a function...
Aha thanks......I just noticed this in another thread
Should This work? ie in a function node, access RED.settings?
No. When I say 'in a node' I mean a node's runtime code has access to the RED.settings
object.
The code inside a Function node does not.
There are lots of ways to get at the port for the Editor/admin API. For example, check whether a function node can access the browser window data which includes the current url.
Or you could pass the port to a global var from within setttings.js. Similarly you could also set the port environment variable from within settings.js as well if you don't want to mess with it externally.
Aha...ok thanks
Thanks all.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.