/*
 * @Author: 吴永生#A02208 yongsheng.wu@wholion.com
 * @Date: 2022-05-31 10:17:48
 * @LastEditors: 吴永生 15770852798@163.com
 * @LastEditTime: 2022-10-17 11:51:35
 * @FilePath: /bkunyun/src/api/api_prefix.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// const AWSPREFIX = "/0xaws";
// const PRIVATIZATIONPREFIX = "/fileserver";
// const PRIVATIZATION_API_URI_PREFIX = process.env.NODE_ENV === 'development' ? "http://123.57.131.31" : "";

let BACKEND_API_URI_PREFIX = "";
console.log("process.env.REACT_APP_ENV: ", process.env.REACT_APP_ENV);
switch (process.env.REACT_APP_ENV) {
  case "dev-cn":
    BACKEND_API_URI_PREFIX = "http://47.57.4.97";
    break;
  case "dev-en":
    BACKEND_API_URI_PREFIX = "http://47.75.109.159";
    break;
  case "release-cn":
    BACKEND_API_URI_PREFIX = "http://47.75.104.171";
    break;
  case "release-en":
    BACKEND_API_URI_PREFIX = "http://47.57.235.86";
    break;
  case "global":
    BACKEND_API_URI_PREFIX = "https://www.cloudam.io";
    break;
  default:
    if (["www.bkunyun.com"].includes(window.location.host)) {
      BACKEND_API_URI_PREFIX = "https://www.bkunyun.com";
    } 
    else if (["www.cloudam.cn"].includes(window.location.host)) {
      BACKEND_API_URI_PREFIX = "https://www.cloudam.cn";
    }
    else {
      BACKEND_API_URI_PREFIX = "http://47.57.4.97";
    }
    break;
}

export { BACKEND_API_URI_PREFIX }; // 导出放在11行后面，避免发布时被替换
