Files
schoolNews/docker/config/web-app-config.js
2025-11-24 11:50:15 +08:00

75 lines
2.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 前端应用配置文件
*
* 此文件用于Docker部署时的配置外挂
* 挂载方式docker-compose.yml 中配置
* volumes:
* - ./config/web-app-config.js:/app/config/app-config.js
*
* 修改步骤:
* 1. 编辑此文件
* 2. 重启容器docker-compose restart school-news-web
* 3. 刷新浏览器即可生效
*
* 注意:此文件结构必须与 schoolNewsWeb/public/app-config.js 保持一致
*/
(function() {
'use strict';
window.APP_RUNTIME_CONFIG = {
// 环境标识
env: 'production',
// API 配置
api: {
baseUrl: '/schoolNewsServ', // API基础路径
timeout: 30000 // 请求超时时间(毫秒)
},
// 应用基础路径
baseUrl: '/schoolNewsWeb/',
// 文件配置
file: {
downloadUrl: '/schoolNewsServ/file/download/',
uploadUrl: '/schoolNewsServ/file/upload/',
maxSize: {
image: 5, // MB
video: 100, // MB
document: 10 // MB
},
acceptTypes: {
image: 'image/*',
video: 'video/*',
document: '.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx'
}
},
// Token 配置
token: {
key: 'token',
refreshThreshold: 300000 // 5分钟毫秒
},
// 公共路径
publicImgPath: '/schoolNewsWeb/img',
publicWebPath: '/schoolNewsWeb',
// 功能开关(可自由扩展)
features: {
enableDebug: false, // 是否启用调试模式
enableMockData: false // 是否启用Mock数据
}
};
// 配置加载完成标记
window.__CONFIG_LOADED__ = true;
// 控制台输出配置信息
if (console && console.log) {
console.log('%c[配置]%c Docker配置已加载', 'color: green; font-weight: bold', 'color: inherit');
console.log('[配置] 环境:', window.APP_RUNTIME_CONFIG.env);
console.log('[配置] API地址:', window.APP_RUNTIME_CONFIG.api.baseUrl);
}
})();