How would I do the following in javascript?
>>> import socket
>>> socket.gethostname()
'LA-DEV-IM-MM'
I am using a gulp command and I'd like to do something like:
if (socket_name in [ip1, ip2, ip3]) {
mode = dev;
} else {
mode = prod;
}
How would I do the following in javascript?
>>> import socket
>>> socket.gethostname()
'LA-DEV-IM-MM'
I am using a gulp command and I'd like to do something like:
if (socket_name in [ip1, ip2, ip3]) {
mode = dev;
} else {
mode = prod;
}
What you are looking for is os.hostname().
Note that this API is only available in Node.js. It is not available in the browser environment.