1
This commit is contained in:
110
config/framework.config.js
Normal file
110
config/framework.config.js
Normal file
@@ -0,0 +1,110 @@
|
||||
/**
|
||||
* 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": "BallBookingMiniProgram",
|
||||
// 数据库配置(必需)
|
||||
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 || 'production';
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user