60 lines
1.0 KiB
JavaScript
60 lines
1.0 KiB
JavaScript
/* 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 + '_1605853804883_9478';
|
|
|
|
// add your middleware config here
|
|
config.middleware = [];
|
|
|
|
// add your user config here
|
|
const userConfig = {
|
|
// myAppName: 'egg',
|
|
};
|
|
|
|
config.multipart = {
|
|
mode: 'file',
|
|
fieldNameSize: 100,
|
|
fieldSize: '100kb',
|
|
fields: 9,
|
|
fileSize: '10mb',
|
|
files: 9,
|
|
whitelist: [ '.jpg', '.jpeg', '.png', '.gif', '.webp', '.bmp' ],
|
|
};
|
|
|
|
config.security = {
|
|
csrf: {
|
|
enable: false,
|
|
},
|
|
};
|
|
|
|
config.onerror = {
|
|
all(error, ctx) {
|
|
ctx.body = { errcode: 500, desc: error, result: false, data: null };
|
|
ctx.status = 500;
|
|
},
|
|
};
|
|
|
|
config.cluster = {
|
|
listen: {
|
|
port: 3001,
|
|
},
|
|
};
|
|
|
|
return {
|
|
...config,
|
|
...userConfig,
|
|
};
|
|
};
|