I have set httpStatic: '/media/usbHDD/nas/', in my settings.js file everything is working fine however my question is can I retrieve this information in a function node.?
A possible solution (not sure if there is another way) is to add a property to functionGlobalContext
in settings.js
. Then it can be easily retrieved in a function node.
It is a sort of double work (as you already created httpStatic
entry in settings.js
but it works.
Example:
functionGlobalContext: {
myStatic:'/home/andrei/node-red-static/',
Then recover with
var test1 = global.get('myStatic');
I think that you should be able to do something like mystatic: this.httpStatic
so you only set it once.
Alternatively, set a const outside the exports and use the value in both places.
If you are writing custom nodes, you can retrieve the values in settings.js but I don't know that you can otherwise.