config.default.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* eslint valid-jsdoc: "off" */
  2. 'use strict';
  3. /**
  4. * @param {Egg.EggAppInfo} appInfo app info
  5. */
  6. module.exports = appInfo => {
  7. /**
  8. * built-in config
  9. * @type {Egg.EggAppConfig}
  10. **/
  11. const config = exports = {};
  12. // use for cookie sign key, should change to your own and keep security
  13. config.keys = appInfo.name + '_1618984590142_9986';
  14. // add your middleware config here
  15. config.middleware = [];
  16. // 关闭安全防范
  17. config.security = {
  18. csrf: {
  19. enable: false,
  20. ignoreJSON: true,
  21. },
  22. };
  23. config.cors = {
  24. origin: '*',
  25. allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS',
  26. };
  27. // add your user config here
  28. const userConfig = {
  29. // myAppName: 'egg',
  30. };
  31. // 解除文件上传大小限制
  32. // config.bodyParser = {
  33. // jsonLimit: '100mb',
  34. // formLimit: '100mb',
  35. // };
  36. config.multipart = {
  37. fileSize: '50mb',
  38. mode: 'stream',
  39. fileExtensions: [ '.xls', '.png', '.jpg', '.doc', '.xlsx', '.docx', '.rar', '.zip', '.7z', '.pdf' ], // 扩展几种上传的文件格式
  40. };
  41. // jwt密钥
  42. config.jwt = {
  43. secret: '123456',
  44. };
  45. config.userSecret = '123456';
  46. config.filespath = '/home/cms';
  47. // 数据库配置
  48. config.mongoose = {
  49. url: 'mongodb://172.17.116.7:27018/cms',
  50. options: {
  51. user: 'root',
  52. pass: 'cms@cc-lotus',
  53. authSource: 'admin',
  54. useNewUrlParser: true,
  55. useCreateIndex: true,
  56. useUnifiedTopology: true,
  57. },
  58. };
  59. // config.mongoose = {
  60. // url: 'mongodb://127.0.0.1:27017/example',
  61. // options: {},
  62. // };
  63. // 异常捕获
  64. config.middleware = [ 'errorHandler' ];
  65. config.errorHandler = {
  66. match: '/api',
  67. };
  68. return {
  69. ...config,
  70. ...userConfig,
  71. };
  72. };