/* eslint valid-jsdoc: "off" */ 'use strict'; /** * @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 + '_1618984590142_9986'; // add your middleware config here config.middleware = []; // 关闭安全防范 config.security = { csrf: { enable: false, ignoreJSON: true, }, }; config.cluster = { listen: { port: 18099, }, }; config.cors = { origin: '*', allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS', }; // add your user config here const userConfig = { // myAppName: 'egg', }; // 解除上传大小限制 config.bodyParser = { jsonLimit: '100mb', formLimit: '100mb', }; // 解除文件上传大小限制 config.multipart = { fileSize: '50mb', mode: 'stream', fileExtensions: [ '.xls', '.png', '.jpg', '.doc', '.xlsx', '.docx', '.rar', '.zip', '.7z', '.pdf' ], // 扩展几种上传的文件格式 }; // jwt密钥 config.jwt = { secret: '123456', }; config.userSecret = '123456'; config.filespath = '/var/www/jjzh'; // 数据库配置 config.mongoose = { url: 'mongodb://127.0.0.1:27017/cms', }; // config.mongoose = { // url: 'mongodb://127.0.0.1:27018/cms', // options: { // user: 'root', // pass: 'cms@cc-lotus', // authSource: 'admin', // useNewUrlParser: true, // useCreateIndex: true, // useUnifiedTopology: true, // }, // }; // 异常捕获 路由拦截 config.middleware = [ 'errorHandler' ]; config.errorHandler = { match: '/api', }; return { ...config, ...userConfig, }; };