%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/emergentqj/actioncivile/pre-auth/def/static/js/utils/
Upload File :
Create Path :
Current File : /home/emergentqj/actioncivile/pre-auth/def/static/js/utils/getEnvConstant.js

import appEnvs from "config/appEnvs";
import isDomEnabled from "./isDomEnabled";

const { NODE_ENV } = process.env;

export default function getEnvConstant() {
  const envs = appEnvs;

  // eslint-disable-next-line func-names
  const getEnv = function (fallbackEnv) {
    if (isDomEnabled) {
      const hostName = window.location.hostname;
      for (const key in envs) {
        if (Object.prototype.hasOwnProperty.call(envs, key)) {
          if (envs[key].indexOf(hostName) > -1) return key;
        }
      }
    } else {
      if (NODE_ENV === "production") {
        return "production";
      }
      if (NODE_ENV === "staging") {
        return "staging";
      }
      return "develop";
    }
    return fallbackEnv;
  };

  return getEnv("production");
}

Zerion Mini Shell 1.0