Groups
Groups
Sign in
Groups
Groups
Node-RED
Conversations
About
Send feedback
Help
extract host name of the node-red host, with JS ?
1,042 views
Skip to first unread message
Jéan Roux
unread,
Jun 2, 2017, 4:00:55 PM
6/2/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Node-RED
Hi, can I get the host name of the underlying server to nodered with Javascript, that I can use in a function node? I tried
msg
.
payload
=
location
.
host
;
as per normal JS, but this does not work?
Dave C-J
unread,
Jun 2, 2017, 4:17:52 PM
6/2/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to node...@googlegroups.com
one way is to include the "os" library in the functionGlobal section of your settings.js
os:require('os')
then you can use a function node with something like
msg.payload = context.global.os.hostname();
Jéan Roux
unread,
Jun 2, 2017, 4:26:29 PM
6/2/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Node-RED
Tx Dave.
Reply all
Reply to author
Forward
0 new messages