80 lines
1.7 KiB
JavaScript
80 lines
1.7 KiB
JavaScript
/* eslint valid-jsdoc: "off" */
|
||
|
||
/**
|
||
* @param {Egg.EggAppInfo} appInfo app info
|
||
*/
|
||
module.exports = appInfo => {
|
||
/**
|
||
* built-in config
|
||
* @type {Egg.EggAppConfig}
|
||
**/
|
||
const config = exports = {};
|
||
|
||
// use for cookie sign key, should change to your own and keep security
|
||
config.keys = appInfo.name + '_1772789382448_6777';
|
||
|
||
// add your middleware config here
|
||
config.cluster = {
|
||
listen: {
|
||
port: 4050, // 使用其他端口避免冲突
|
||
hostname: '0.0.0.0',
|
||
},
|
||
};
|
||
// add your user config here
|
||
const userConfig = {
|
||
// myAppName: 'egg',
|
||
};
|
||
config.bodyParser = {
|
||
jsonLimit: '10mb', // 增大 JSON 体限制
|
||
formLimit: '10mb', // 增大表单限制
|
||
textLimit: '10mb', // 增大文本限制
|
||
enableTypes: ['json', 'form', 'text'],
|
||
extendTypes: {
|
||
json: ['application/json'],
|
||
},
|
||
};
|
||
config.mysql = {
|
||
clients: {
|
||
wms: {
|
||
host: '127.0.0.1',
|
||
port: '3306',
|
||
user: 'wms',
|
||
password: 'P6j3YTHTpirepYWz',
|
||
database: 'wms',
|
||
},
|
||
},
|
||
app: true,
|
||
agent: false,
|
||
};
|
||
|
||
config.security = {
|
||
csrf: {
|
||
enable: false,
|
||
},
|
||
};
|
||
config.redis = {
|
||
client: {
|
||
host: '127.0.0.1', // Redis服务器地址
|
||
port: 6379, // Redis端口
|
||
password: 'qwe2019@', // Redis密码(如果有)
|
||
db: 11, // 使用的数据库索引
|
||
},
|
||
};
|
||
config.websocket = {
|
||
// 使用 Redis 适配器
|
||
adapter: {
|
||
type: 'redis',
|
||
redis: config.redis.client, // 复用 Redis 配置
|
||
},
|
||
// 或者更简单的配置方式
|
||
redis: config.redis.client,
|
||
};
|
||
config.jwt = {
|
||
secret: 'E5#ex.g@,GfL_8?', // 请替换为自己的密钥
|
||
};
|
||
return {
|
||
...config,
|
||
...userConfig,
|
||
};
|
||
};
|