木邻有你前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.2 KiB

1 month ago
  1. // 环境配置相关
  2. /**
  3. * 环境配置
  4. * env 环境变量字段
  5. * netConfig 网络配置
  6. * aliOSSConfig 阿里云配置
  7. * debounceConfig 防抖相关配置
  8. */
  9. const env = 'testing' || 'development' || 'production'
  10. // 全局配置
  11. const config = {
  12. netConfig: {
  13. development: {
  14. baseURL: 'http://augcl.natapp1.cc/community-admin/community',
  15. },
  16. testing: {
  17. baseURL: 'https://mulinyouni.augcl.com/community-admin/community',
  18. },
  19. production: {
  20. baseURL: 'https://api.escuelajs.co/api/v1',
  21. }
  22. },
  23. aliOSSConfig :{
  24. aliOSS_accessKey: 'LTAI5tQSs47izVy8DLVdwUU9',
  25. aliOSS_secretKey: 'qHI7C3PaXYZySr84HTToviC71AYlFq',
  26. aliOSS_bucketName: 'hanhaiimage',
  27. endpoint: 'oss-cn-shenzhen.aliyuncs.com',
  28. staticDomain: 'https://image.hhlm1688.com/'
  29. },
  30. debounceConfig : {
  31. DEFAULT_DEBOUNCE_TIME: 0,
  32. DEFAULT_THROTTLE_TIME: 0,
  33. MAX_MAP_SIZE: 1000,
  34. }
  35. }
  36. // 全自动导入并生成平坦化结构
  37. const finalConfig = Object.keys(config).reduce((finallyConfig, key) => {
  38. let tempConfig = {}
  39. if (key === 'netConfig') {
  40. tempConfig = config[key][env]
  41. }else {
  42. tempConfig = config[key]
  43. }
  44. return {
  45. ...finallyConfig,
  46. ...tempConfig,
  47. }
  48. }, {})
  49. export default finalConfig