Automatically detect hostname