Files
autoAiWorkSys/config/framework.config.js
张成 4d712f8332 1
2025-12-16 10:55:59 +08:00

111 lines
2.3 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.
/**
* Framework 配置文件
* 基于 node-core-framework 的配置
*/
const baseConfig = require('./config.js');
const customSchemas = require('./custom.schemas.js');
module.exports = {
// ===== 必需配置 =====
env: process.env.NODE_ENV || 'development',
"project_key": "autoAiWorkSys",
// 数据库配置(必需)
db: {
username: baseConfig.db.username,
password: baseConfig.db.password,
database: baseConfig.db.database,
host: baseConfig.db.host,
port: baseConfig.db.port || 3306,
dialect: baseConfig.db.dialect || 'mysql',
timezone: '+08:00',
pool: {
max: 10,
min: 0,
acquire: 30000,
idle: 10000
},
logging: false
},
// API 路径配置(必需)
apiPaths: [
{
path: './api/controller_front',
prefix: '/api',
authType: 'applet'
},
{
path: './api/controller_admin',
prefix: '/admin_api',
authType: 'admin'
}
],
"fileConifg": {
"vue": {
"api": "../../admin/src/api/",
"view": "../../admin/src/view/"
},
"node": {
"controller": "../controller_admin/",
"model": "../model/"
}
},
// API文档配置
swagger: {
title: '约球小程序后端 API',
version: '1.0.0',
description: '约球小程序后端服务 API 文档',
contact: {
name: '开发团队',
email: 'dev@example.com'
}
},
// ===== 建议配置 =====
// 基础 URL根据环境区分
baseUrl: (() => {
const env = process.env.NODE_ENV || 'development';
switch (env) {
case 'production':
return 'https://work.light120.com'; // 生产环境
case 'development':
default:
return 'http://localhost:9097'; // 开发环境
}
})(),
// 日志路径
logPath: './logs',
// 白名单 URL不需要认证的接口
allowUrls: baseConfig.allowUrls,
// 授权文件路径(可选,如果不需要授权验证可以设置为 null
// 授权验证配置
license: {
licensePath: require('path').join(__dirname, '_license', 'license.lic')
},
// Redis 配置
redis: baseConfig.redis || null,
// 模型路径
modelPaths: './api/model',
// ===== 业务配置(从原 config.js 继承)=====
// 端口配置
port: baseConfig.port,
// 自定义 Swagger Schemas
customSchemas: customSchemas
};