Avoid potential exception when configuring profile name
 - Try to resolve host name only if the property hasn't been set in the configuration
 - Rename HOSTNAME -> hostName as it isn't a constant