env.uts
7.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/**
* 环境配置(从 gl_tape 迁移)
* 0: ip 本地 1: dev 开发 2: test 测试 3: prod 生产 4: beta 预发布
*/
const TARGET_OPTIONS = ["ip", "dev", "test", "prod", "beta"];
const TARGET_INDEX = 2;
// 为兼容 UTS 的限制,这里不再使用复杂的类型约束,统一用 UTSJSONObject
type SecretKeyItem = UTSJSONObject;
type SecretKeyMap = UTSJSONObject;
type SignSecretKeyItem = UTSJSONObject;
const secretKeyMap: UTSJSONObject = {
ip: {},
dev: {
sso: {
appKey: "8b31ae1009ccb0f96130ca4bd90e3d89",
secret: "02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b"
}
},
test: {
sso: {
appKey: "8b31ae1009ccb0f96130ca4bd90e3d89",
secret: "02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b"
}
},
prod: {
sso: {
appKey: "8b31ae1009ccb0f96130ca4bd90e3d89",
secret: "02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b"
}
},
beta: {
sso: {
appKey: "8b31ae1009ccb0f96130ca4bd90e3d89",
secret: "02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b"
}
}
};
const domainMap: UTSJSONObject = {
ip: "http://192.168.1.122:8292",
dev: "https://scrm.dev.glsx.com.cn",
test: "https://scrm.test.glsx.com.cn",
beta: "https://scrm.beta.glsx.com.cn",
prod: "https://scrm.glsx.com.cn"
};
const evaluationDomainMap: UTSJSONObject = {
ip: "http://192.168.1.221:5003",
dev: "http://gsc.dev.glsx.com.cn",
beta: "https://gsc.beta.glsx.com.cn",
test: "http://gsc.test.glsx.com.cn",
prod: "https://gsc.glsx.com.cn",
pet: "https://cdptest.glsx.com.cn"
};
const djDomainMap: UTSJSONObject = {
ip: "http://192.168.1.122:8292",
dev: "http://dj.dev.glsx.com.cn",
beta: "https://dj.beta.glsx.com.cn",
test: "https://dj.test.glsx.com.cn",
prod: "https://dj.glsx.com.cn",
pet: "https://cdptest.glsx.com.cn"
};
/** 数科 linkwe-gateway(与 simgle_app/env.js shukeDomain 对齐) */
const shukeDomainMap: UTSJSONObject = {
ip: "http://wescrm.test.glshuke.com",
dev: "http://wescrm.test.glshuke.com",
test: "http://wescrm.test.glshuke.com",
beta: "http://wescrm.beta.glshuke.com",
prod: "http://wescrm.test.glshuke.com",
pet: "http://wescrm.test.glshuke.com"
};
const merchantDomainMap: UTSJSONObject = {
ip: "http://rop-merchant.dev.glsx.com.cn",
dev: "http://rop-merchant.dev.glsx.com.cn",
beta: "https://rop-merchant.beta.glsx.com.cn",
test: "https://rop-merchant.test.glsx.com.cn",
prod: "https://commodity.glsx.com.cn",
pet: ""
};
const djSecretKeyMap: UTSJSONObject = {
ip: { appKey: "48e5e13229b82c1b4e6e8c96151f0637", secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b" },
dev: { appKey: "48e5e13229b82c1b4e6e8c96151f0637", secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b" },
test: { appKey: "48e5e13229b82c1b4e6e8c96151f0637", secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b" },
beta: { appKey: "48e5e13229b82c1b4e6e8c96151f0637", secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b" },
prod: { appKey: "d7ffc3346fc9a45bccaaa35300d59022", secret: "4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353" },
pet: { appKey: "d7ffc3346fc9a45bccaaa35300d59022", secret: "4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353" }
};
const signSecretKeyMap: UTSJSONObject = {
ip: {
appKey: "App_PromoteBusiness",
secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b",
carBasrUrl: "http://qcdidicb.glsx.com.cn/router",
pdfUrl:
"https://jinrong-huidan-test.oss-cn-shenzhen.aliyuncs.com/testdev/8981c8ca-8b30-436e-bb17-82fb6a53a3c4%E4%BA%8C%E6%89%8B%E8%BD%A6%E8%BD%AC%E8%AE%A9%E5%8D%8F%E8%AE%AE.pdf"
},
dev: {
appKey: "App_PromoteBusiness",
secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b",
carBasrUrl: "http://qcdidicb.glsx.com.cn/router",
pdfUrl:
"https://jinrong-huidan-test.oss-cn-shenzhen.aliyuncs.com/testdev/8981c8ca-8b30-436e-bb17-82fb6a53a3c4%E4%BA%8C%E6%89%8B%E8%BD%A6%E8%BD%AC%E8%AE%A9%E5%8D%8F%E8%AE%AE.pdf"
},
test: {
appKey: "App_PromoteBusiness",
secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b",
carBasrUrl: "http://qcdidicb.glsx.com.cn/router",
pdfUrl:
"https://jinrong-huidan-test.oss-cn-shenzhen.aliyuncs.com/testdev/8981c8ca-8b30-436e-bb17-82fb6a53a3c4%E4%BA%8C%E6%89%8B%E8%BD%A6%E8%BD%AC%E8%AE%A9%E5%8D%8F%E8%AE%AE.pdf"
},
beta: {
appKey: "App_PromoteBusiness",
secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b",
carBasrUrl: "http://didicb.glsx.com.cn/router",
pdfUrl:
"https://dj-oss-fastdfs-release.oss-cn-shenzhen.aliyuncs.com/release/3b7558fa-8b73-48ce-af40-7b853b0ea7de%E4%BA%8C%E6%89%8B%E8%BD%A6%E8%BD%AC%E8%AE%A9%E5%8D%8F%E8%AE%AE.pdf?wework_cfm_code=MvGt9rGpf0SNZt3fX0sBRZyHAe4qyfG0tz%2BFurp9RbBYoiLzPGcBycaKYEJM76NISOqT4SHJWZi8VU6YBosMk4ZDmdsk7bDma%2FQOkR8GLN7rZHtT3dOTFpQSKB3yR45vv%2BxKpsogpxQr7pO%2BtIwK6JWcEobZT%2FYnTEzlDwnhdbAt2emEro5iNhhuIIqDJiTM9pmgchS7G%2F77HbSGCNpq7oI%3D"
},
prod: {
appKey: "App_PromoteBusiness",
secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b",
carBasrUrl: "http://didicb.glsx.com.cn/router",
pdfUrl:
"https://dj-oss-fastdfs-release.oss-cn-shenzhen.aliyuncs.com/release/3b7558fa-8b73-48ce-af40-7b853b0ea7de%E4%BA%8C%E6%89%8B%E8%BD%A6%E8%BD%AC%E8%AE%A9%E5%8D%8F%E8%AE%AE.pdf?wework_cfm_code=MvGt9rGpf0SNZt3fX0sBRZyHAe4qyfG0tz%2BFurp9RbBYoiLzPGcBycaKYEJM76NISOqT4SHJWZi8VU6YBosMk4ZDmdsk7bDma%2FQOkR8GLN7rZHtT3dOTFpQSKB3yR45vv%2BxKpsogpxQr7pO%2BtIwK6JWcEobZT%2FYnTEzlDwnhdbAt2emEro5iNhhuIIqDJiTM9pmgchS7G%2F77HbSGCNpq7oI%3D"
},
pet: {
appKey: "App_PromoteBusiness",
secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b",
carBasrUrl: "http://qcdidicb.glsx.com.cn/router",
pdfUrl:
"https://jinrong-huidan-test.oss-cn-shenzhen.aliyuncs.com/testdev/8981c8ca-8b30-436e-bb17-82fb6a53a3c4%E4%BA%8C%E6%89%8B%E8%BD%A6%E8%BD%AC%E8%AE%A9%E5%8D%8F%E8%AE%AE.pdf"
}
};
const PATH_ENUM = {
sso: "/rop-scrm-sso/",
shopmall: "/rop-scrm-shopmall/",
coupon: "/rop-scrm-coupon/",
carlife: "/rop-scrm-carlife/",
live: "/rop-scrm-live/",
equity: "/rop-scrm-equity/",
entmicro: "/rop-scrm-entmicro/",
wechat: "/rop-scrm-wechat/",
boutiquecoupon: "/rop-scrm-boutiquecoupon/",
material: "/rop-scrm-marketing/",
sop: "/rop-scrm-sop/",
customercollect: "/rop-scrm-bigdatautil/",
mindworkplate: "/rop-dj-smartcarlife/",
drac: "/rop-scrm-entmicro/",
busassistant: "/rop-scrm-busassistant/",
boutique: "/rop-dj-car-boutique/",
merchants: "/rop-merchants/",
pad: "/rop-dj-pad/",
clue: "/rop-scrm-clue/",
evaluation: "/gsc-vcp-pad-facade",
staffMiniprogram: "/rop-dj-staff-miniprogram/"
};
const rawTarget = TARGET_OPTIONS[TARGET_INDEX] as string | null;
const currentTarget = rawTarget != null ? rawTarget : "test";
function pickEnvObject(source: UTSJSONObject): UTSJSONObject {
const currentValue = source[currentTarget] as UTSJSONObject | null;
if (currentValue != null) {
return currentValue;
}
const fallbackValue = source["test"] as UTSJSONObject | null;
return fallbackValue != null ? fallbackValue : {} as UTSJSONObject;
}
function pickEnvString(source: UTSJSONObject): string {
const currentValue = source[currentTarget] as string | null;
if (currentValue != null) {
return currentValue;
}
const fallbackValue = source["test"] as string | null;
return fallbackValue != null ? fallbackValue : "";
}
export const secretKey: SecretKeyMap = pickEnvObject(secretKeyMap) as SecretKeyMap;
export const domain: string = pickEnvString(domainMap);
export const evaluationDomain: string = pickEnvString(evaluationDomainMap);
export const djDomain: string = pickEnvString(djDomainMap);
export const shukeDomain: string = pickEnvString(shukeDomainMap);
export const merchantDomain: string = pickEnvString(merchantDomainMap);
export const djSecretKey: SecretKeyItem = pickEnvObject(djSecretKeyMap) as SecretKeyItem;
export const signSecretKey: SignSecretKeyItem = pickEnvObject(signSecretKeyMap) as SignSecretKeyItem;
export const pathEnum: UTSJSONObject = PATH_ENUM;
export const pathEnumExport: UTSJSONObject = PATH_ENUM;
// env 仅用于区分当前环境标签,这里直接按 TARGET_INDEX 映射为字符串
export const env: string = TARGET_INDEX == 3 ? "production" : (TARGET_INDEX == 1 ? "develop" : "test");