config.default.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. 'use strict';
  2. const path = require('path');
  3. module.exports = appInfo => {
  4. const config = {};
  5. // should change to your own
  6. config.keys = appInfo.name + '_1503910434503_882';
  7. // view相关
  8. config.view = {
  9. mapping: {
  10. '.ejs': 'ejs',
  11. },
  12. root: [
  13. path.join(appInfo.baseDir, 'app/view'),
  14. ].join(','),
  15. };
  16. // 分页相关
  17. config.pageSize = 15;
  18. // 中间件
  19. config.middleware = ['urlParse'];
  20. // session配置
  21. config.session = {
  22. key: 'ZHC_SESS',
  23. maxAge: 3600 * 1000, // 1小时
  24. httpOnly: true,
  25. encrypt: true,
  26. };
  27. // session使用redis
  28. exports.sessionRedis = {
  29. name: 'session',
  30. };
  31. // 缓存时间
  32. config.cacheTime = 1800;
  33. // 安全性配置
  34. config.security = {
  35. csrf: {
  36. ignoreJSON: true, // 默认为 false,当设置为 true 时,将会放过所有 content-type 为 `application/json` 的请求
  37. },
  38. };
  39. return config;
  40. };