config.default.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* eslint valid-jsdoc: "off" */
  2. 'use strict';
  3. /**
  4. * @param {Egg.EggAppInfo} appInfo app info
  5. */
  6. const { sep } = require('path');
  7. const user = require('../app/importFiled/user');
  8. const vip = require('../app/importFiled/vip');
  9. const exportuser = require('../app/exportFiled/user');
  10. const exportvip = require('../app/exportFiled/vip');
  11. module.exports = appInfo => {
  12. /**
  13. * built-in config
  14. * @type {Egg.EggAppConfig}
  15. **/
  16. const config = exports = {};
  17. // use for cookie sign key, should change to your own and keep security
  18. config.keys = appInfo.name + '_1635902541751_9477';
  19. // add your middleware config here
  20. config.middleware = [];
  21. // add your user config here
  22. const userConfig = {
  23. // myAppName: 'egg',
  24. };
  25. // 安全配置
  26. config.security = {
  27. csrf: {
  28. // ignoreJSON: true, // 默认为 false,当设置为 true 时,将会放过所有 content-type 为 `application/json` 的请求
  29. enable: false,
  30. },
  31. };
  32. config.cluster = {
  33. listen: {
  34. port: 9016,
  35. },
  36. };
  37. // 数据库配置
  38. config.mongoose = {
  39. url: 'mongodb://127.0.0.1/Microservices',
  40. options: {
  41. // user: 'root',
  42. // pass: 'cms@cc-lotus',
  43. // authSource: 'admin',
  44. // useNewUrlParser: true,
  45. // useCreateIndex: true,
  46. },
  47. };
  48. // 限制文件大小
  49. config.multipart = {
  50. mode: 'file',
  51. fileSize: '50mb',
  52. fileExtensions: [ '.zip', '.xlsx', '.xls' ], // 新增允许接收的文件后缀
  53. // whitelist: [], // 覆盖允许接收的文件后缀
  54. };
  55. config.filed = { user, vip };
  56. config.exportFiled = { exportuser, exportvip };
  57. config.exportsPath = `${appInfo.baseDir}${sep}exports`;
  58. config.templatePath = `${appInfo.baseDir}${sep}templates`;
  59. config.logger = {
  60. level: 'DEBUG',
  61. };
  62. return {
  63. ...config,
  64. ...userConfig,
  65. };
  66. };