@alicloud/console-base-conf-parse-env 1.4.10 → 1.4.11-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -44,8 +44,11 @@ function parseEnv() {
|
|
|
44
44
|
// 是否 日常环境
|
|
45
45
|
var DOMAIN_IS_TEST = /\.test$/.test(hostname);
|
|
46
46
|
|
|
47
|
+
// 是否 为 cn 域名
|
|
48
|
+
var DOMAIN_IS_CN = /\.cn$/.test(hostname);
|
|
49
|
+
|
|
47
50
|
// 是否 控制台
|
|
48
|
-
var DOMAIN_IS_CONSOLE =
|
|
51
|
+
var DOMAIN_IS_CONSOLE = /console\.aliyun\.(?:com|cn|test)$/.test(hostname);
|
|
49
52
|
|
|
50
53
|
/**
|
|
51
54
|
* 需要兼容的域名:
|
|
@@ -61,13 +64,13 @@ function parseEnv() {
|
|
|
61
64
|
* 后缀:获取 domain 最后的路径,并以 aliyun 作为兜底
|
|
62
65
|
* 顶级域名:测试环境是 test,其他环境是 com
|
|
63
66
|
*/
|
|
64
|
-
var fecsPrefixDomain =
|
|
67
|
+
var fecsPrefixDomain = ENV_IS_PROD || DOMAIN_IS_CN ? 'fecs' : 'pre-fecs'; // cn 域名下只能请求线上 fecs 接口
|
|
65
68
|
var prefixDomain = DOMAIN_IS_4SERVICE ? 'fecs4service' : fecsPrefixDomain;
|
|
66
69
|
var suffixDomain = ((_hostname$match = hostname.match(/[^.]+(?=\.[^.]+$)/)) === null || _hostname$match === void 0 ? void 0 : _hostname$match[0]) || 'aliyun';
|
|
67
70
|
if (suffixDomain === 'aliyun-inc' || suffixDomain === 'alibaba-inc') {
|
|
68
71
|
suffixDomain = 'aliyun';
|
|
69
72
|
}
|
|
70
|
-
var topDomain = "".concat(DOMAIN_IS_TEST ? 'test' : 'com');
|
|
73
|
+
var topDomain = "".concat(DOMAIN_IS_TEST ? 'test' : DOMAIN_IS_CN ? 'cn' : 'com');
|
|
71
74
|
var FECS_HOST = "".concat(prefixDomain, ".console.").concat(suffixDomain, ".").concat(topDomain);
|
|
72
75
|
|
|
73
76
|
// 这个不推荐用 protocol-relative,Firefox 调用 CORS 时,有可能 request.header.Origin 是 null 而导致接口失败...
|
|
@@ -38,8 +38,11 @@ export default function parseEnv() {
|
|
|
38
38
|
// 是否 日常环境
|
|
39
39
|
var DOMAIN_IS_TEST = /\.test$/.test(hostname);
|
|
40
40
|
|
|
41
|
+
// 是否 为 cn 域名
|
|
42
|
+
var DOMAIN_IS_CN = /\.cn$/.test(hostname);
|
|
43
|
+
|
|
41
44
|
// 是否 控制台
|
|
42
|
-
var DOMAIN_IS_CONSOLE =
|
|
45
|
+
var DOMAIN_IS_CONSOLE = /console\.aliyun\.(?:com|cn|test)$/.test(hostname);
|
|
43
46
|
|
|
44
47
|
/**
|
|
45
48
|
* 需要兼容的域名:
|
|
@@ -55,13 +58,13 @@ export default function parseEnv() {
|
|
|
55
58
|
* 后缀:获取 domain 最后的路径,并以 aliyun 作为兜底
|
|
56
59
|
* 顶级域名:测试环境是 test,其他环境是 com
|
|
57
60
|
*/
|
|
58
|
-
var fecsPrefixDomain =
|
|
61
|
+
var fecsPrefixDomain = ENV_IS_PROD || DOMAIN_IS_CN ? 'fecs' : 'pre-fecs'; // cn 域名下只能请求线上 fecs 接口
|
|
59
62
|
var prefixDomain = DOMAIN_IS_4SERVICE ? 'fecs4service' : fecsPrefixDomain;
|
|
60
63
|
var suffixDomain = ((_hostname$match = hostname.match(/[^.]+(?=\.[^.]+$)/)) === null || _hostname$match === void 0 ? void 0 : _hostname$match[0]) || 'aliyun';
|
|
61
64
|
if (suffixDomain === 'aliyun-inc' || suffixDomain === 'alibaba-inc') {
|
|
62
65
|
suffixDomain = 'aliyun';
|
|
63
66
|
}
|
|
64
|
-
var topDomain = "".concat(DOMAIN_IS_TEST ? 'test' : 'com');
|
|
67
|
+
var topDomain = "".concat(DOMAIN_IS_TEST ? 'test' : DOMAIN_IS_CN ? 'cn' : 'com');
|
|
65
68
|
var FECS_HOST = "".concat(prefixDomain, ".console.").concat(suffixDomain, ".").concat(topDomain);
|
|
66
69
|
|
|
67
70
|
// 这个不推荐用 protocol-relative,Firefox 调用 CORS 时,有可能 request.header.Origin 是 null 而导致接口失败...
|