add `hostname` util, which checks conf before guessing local-hostname
use new hostname util consistently in daemons