0

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;
}
David542
  • 104,438
  • 178
  • 489
  • 842

1 Answers1

0

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.