.env-config.ts 662 B

123456789101112131415161718192021222324252627282930
  1. /** 请求服务的环境配置 */
  2. type ServiceEnv = Record<ServiceEnvType, ServiceEnvConfig>;
  3. /** 不同请求服务的环境配置 */
  4. const serviceEnv: ServiceEnv = {
  5. dev: {
  6. url: 'http://192.168.1.70:8000'
  7. },
  8. test: {
  9. url: 'http://192.168.1.70:8000'
  10. },
  11. prod: {
  12. url: 'http://192.168.1.70:8000'
  13. }
  14. };
  15. /**
  16. * 获取当前环境模式下的请求服务的配置
  17. * @param env 环境
  18. */
  19. export function getServiceEnvConfig(env: ImportMetaEnv): ServiceEnvConfigWithProxyPattern {
  20. const { VITE_SERVICE_ENV = 'dev' } = env;
  21. const config = serviceEnv[VITE_SERVICE_ENV];
  22. return {
  23. ...config,
  24. proxyPattern: '/proxy-pattern'
  25. };
  26. }