/** * 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}`; }