config.default.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. 'use strict';
  2. const { sep } = require('path');
  3. const ErrorConfig = require('./config.error.js');
  4. module.exports = appInfo => {
  5. const config = exports = {};
  6. // use for cookie sign key, should change to your own and keep security
  7. config.keys = appInfo.name + '_1515578157616_3792';
  8. // add your config here
  9. config.middleware = [];
  10. config.cluster = {
  11. listen: {
  12. port: 8009,
  13. },
  14. };
  15. // 安全配置
  16. config.security = {
  17. csrf: {
  18. // ignoreJSON: true, // 默认为 false,当设置为 true 时,将会放过所有 content-type 为 `application/json` 的请求
  19. enable: false,
  20. },
  21. };
  22. config.cdn = {
  23. repos_root_path: `${appInfo.baseDir}${sep}upload`,
  24. repos_root_url: '',
  25. };
  26. config.onerror = ErrorConfig;
  27. // 文件上传配置
  28. config.multipart = {
  29. whitelist: [
  30. '.jpg', '.jpeg', // image/jpeg
  31. '.png',
  32. '.zip', '.rar', // 压缩文件
  33. '.txt',
  34. '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx',
  35. '.dbf',
  36. '.pdf',
  37. ],
  38. fileSize: '5mb',
  39. };
  40. return config;
  41. };