config.default.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* eslint valid-jsdoc: "off" */
  2. 'use strict';
  3. const { jwt } = require('./config.secret');
  4. /**
  5. * @param {Egg.EggAppInfo} appInfo app info
  6. */
  7. module.exports = appInfo => {
  8. /**
  9. * built-in config
  10. * @type {Egg.EggAppConfig}
  11. **/
  12. const config = exports = {};
  13. // use for cookie sign key, should change to your own and keep security
  14. config.keys = appInfo.name + '_1583919835792_8266';
  15. // add your middleware config here
  16. config.middleware = [ 'optlog' ];
  17. // add your user config here
  18. const userConfig = {
  19. // myAppName: 'egg',
  20. };
  21. config.errorMongo = {
  22. details: true,
  23. };
  24. config.errorHanler = {
  25. details: true,
  26. };
  27. // add your config here
  28. config.cluster = {
  29. listen: {
  30. port: 7004,
  31. },
  32. };
  33. // mongoose config
  34. config.mongoose = {
  35. url: 'mongodb://127.0.0.1:27017/financial',
  36. options: {
  37. user: 'admin',
  38. pass: 'admin',
  39. authSource: 'admin',
  40. useNewUrlParser: true,
  41. useCreateIndex: true,
  42. },
  43. };
  44. // 安全配置
  45. config.security = {
  46. csrf: {
  47. // ignoreJSON: true, // 默认为 false,当设置为 true 时,将会放过所有 content-type 为 `application/json` 的请求
  48. enable: false,
  49. },
  50. };
  51. // // JWT config
  52. config.jwt = {
  53. ...jwt,
  54. expiresIn: '1d',
  55. issuer: 'train',
  56. };
  57. return {
  58. ...config,
  59. ...userConfig,
  60. };
  61. };