/* eslint valid-jsdoc: "off" */ 'use strict'; const { sep } = require('path'); const ErrorConfig = require('./config.error.js'); /** * @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 + '_1577518454977_306'; // add your middleware config here config.middleware = []; // add your user config here const userConfig = { // myAppName: 'egg', }; config.cluster = { listen: { port: 8001, }, }; // 安全配置 config.security = { csrf: { // ignoreJSON: true, // 默认为 false,当设置为 true 时,将会放过所有 content-type 为 `application/json` 的请求 enable: false, }, }; config.cdn = { repos_root_path: `${appInfo.baseDir}${sep}upload`, repos_root_url: '', }; config.wx = { wxdown: (appid, media_id) => `http://wx.cc-lotus.info/api.weixin.qq.com/cgi-bin/media/get?appid=${appid}&media_id=${media_id}`, }; config.onerror = ErrorConfig; // 文件上传配置 config.multipart = { whitelist: [ '.jpg', '.jpeg', // image/jpeg '.gif', '.png', '.zip', '.rar', // 压缩文件 '.txt', '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.dbf', '.pdf', '.mp4', '.MP4', '.avi', '.AVI', '.rmvb', ], fileSize: '200mb', }; return { ...config, ...userConfig, }; };