Define a parameter based on host name

I my Gruntfile.js I need to do something like this (pseudocode):

 if (hostname == 'host1') : port=9000 else : port=9001 

How can I get the hostname ? (this will be the host where I run grunt )

+4
source share
1 answer
 var hostname = require("os").hostname(); 
+8
source

All Articles