mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(projects): 1.0 beta
This commit is contained in:
44
env.config.ts
Normal file
44
env.config.ts
Normal file
@ -0,0 +1,44 @@
|
||||
/**
|
||||
* 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 = {
|
||||
dev: {
|
||||
baseURL: mockURL,
|
||||
otherBaseURL: {
|
||||
demo: 'http://localhost:9528'
|
||||
}
|
||||
},
|
||||
test: {
|
||||
baseURL: mockURL,
|
||||
otherBaseURL: {
|
||||
demo: 'http://localhost:9529'
|
||||
}
|
||||
},
|
||||
prod: {
|
||||
baseURL: mockURL,
|
||||
otherBaseURL: {
|
||||
demo: 'http://localhost:9530'
|
||||
}
|
||||
}
|
||||
} satisfies App.Service.ServiceConfigMap;
|
||||
|
||||
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?: string) {
|
||||
if (!key) {
|
||||
return '/proxy';
|
||||
}
|
||||
|
||||
return `/proxy-${key}`;
|
||||
}
|
Reference in New Issue
Block a user