forked from gxwebsoft/mp-10550
refactor(config): 将环境配置文件从 TypeScript 转换为 JavaScript
- 移除 config/env.ts 文件并将环境配置转换为 config/env.js - 更新 config/index.ts 中的导入路径以匹配新的 JavaScript 文件扩展名 - 修改 src/utils/server.ts 中的开发服务器 URL 配置 - 更新 tsconfig.json 的 include 配置移除 config 目录 - 调整环境配置中的 API 地址设置统一使用生产环境地址 - 更新 .workbuddy/expert-history.json 中的时间戳记录
This commit is contained in:
43
config/env.js
Normal file
43
config/env.js
Normal file
@@ -0,0 +1,43 @@
|
||||
// 环境变量配置
|
||||
|
||||
// ============ 环境切换开关(修改这里即可切换环境)============
|
||||
// 可选值: 'development' | 'test' | 'production'
|
||||
const CURRENT_ENV = 'production'
|
||||
// ===========================================================
|
||||
|
||||
export const ENV_CONFIG = {
|
||||
// 开发环境
|
||||
development: {
|
||||
API_BASE_URL: 'https://glt-api.websoft.top/api',
|
||||
SERVER_API_URL: 'https://glt-server.websoft.top/api',
|
||||
APP_NAME: '开发环境',
|
||||
DEBUG: 'true',
|
||||
},
|
||||
// 测试环境
|
||||
test: {
|
||||
API_BASE_URL: 'https://glt-api.websoft.top/api',
|
||||
SERVER_API_URL: 'https://glt-server.websoft.top/api',
|
||||
APP_NAME: '测试环境',
|
||||
DEBUG: 'true',
|
||||
},
|
||||
// 生产环境
|
||||
production: {
|
||||
API_BASE_URL: 'https://glt-api.websoft.top/api',
|
||||
SERVER_API_URL: 'https://glt-server.websoft.top/api',
|
||||
APP_NAME: '桂乐淘',
|
||||
DEBUG: 'false',
|
||||
},
|
||||
}
|
||||
|
||||
// 获取当前环境配置
|
||||
export function getEnvConfig() {
|
||||
return ENV_CONFIG[CURRENT_ENV]
|
||||
}
|
||||
|
||||
// 导出环境变量
|
||||
export const {
|
||||
API_BASE_URL,
|
||||
SERVER_API_URL,
|
||||
APP_NAME,
|
||||
DEBUG
|
||||
} = getEnvConfig()
|
||||
Reference in New Issue
Block a user