You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
871 B
TypeScript

/**
* Create service config by current env
*
* @param env The current env
*/
export function createServiceConfig(env: Env.ImportMeta) {
const baseURL = 'https://www.pychr.com/pychr';
const upyun = 'https://www.pychr.com/cdn';
const serviceConfigMap: App.Service.ServiceConfigMap = {
dev: {
baseURL,
otherBaseURL: {
upyun
}
},
test: {
baseURL,
otherBaseURL: {
upyun
}
},
prod: {
baseURL,
otherBaseURL: {
upyun
}
}
};
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-default';
}
return `/proxy-${key}`;
}