config.default.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. '.mp4','.avi','.mpeg',
  38. ],
  39. fileSize: '10mb',
  40. };
  41. return config;
  42. };