Reworked environment detection to use domain name instead of host name