I would propose to make this a rosparam so it's easier to use with roslaunch. Also, wouldn't it be enough to check for ~hostname?