public static function getEnvNameByHost(string $defaultEnv = null, string $hostname = null): string
    {
        $hostname = $hostname ?: gethostname();

        if (!$hostname) {
            return $defaultEnv;
        }

        foreach (self::$host2env as $kw => $env) {
            if (false !== strpos($hostname, $kw)) {
                return $env;
            }
        }

        return $defaultEnv;
    }