forked from soybeanjs/soybean-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv.config.ts
46 lines (41 loc) · 934 Bytes
/
env.config.ts
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
/**
* Create service config by current env
*
* @param env The current env
*/
export function createServiceConfig(env: Env.ImportMeta) {
const mockURL = 'https://mock.apifox.com/m1/3109515-0-default';
const serviceConfigMap: App.Service.ServiceConfigMap = {
dev: {
baseURL: mockURL,
otherBaseURL: {
demo: 'http://localhost:9528'
}
},
test: {
baseURL: mockURL,
otherBaseURL: {
demo: 'http://localhost:9529'
}
},
prod: {
baseURL: mockURL,
otherBaseURL: {
demo: 'http://localhost:9530'
}
}
};
const { VITE_SERVICE_ENV = 'dev' } = env;
return serviceConfigMap[VITE_SERVICE_ENV];
}
/**
* Get proxy pattern of service url
*
* @param key If not set, will use the default key
*/
export function createProxyPattern(key?: App.Service.OtherBaseURLKey) {
if (!key) {
return '/proxy';
}
return `/proxy-${key}`;
}