config.default.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 + '_1616739379301_3896';
  15. // add your middleware config here
  16. config.middleware = [];
  17. // add your user config here
  18. const userConfig = {
  19. // myAppName: 'egg',
  20. };
  21. // mongoose config
  22. config.mongoose = {
  23. url: 'mongodb://127.0.0.1:27017/article',
  24. options: {
  25. // user: 'admin',
  26. // pass: 'admin',
  27. // authSource: 'admin',
  28. // useNewUrlParser: true,
  29. // useCreateIndex: true,
  30. },
  31. };
  32. // 安全配置
  33. config.security = {
  34. csrf: {
  35. // ignoreJSON: true, // 默认为 false,当设置为 true 时,将会放过所有 content-type 为 `application/json` 的请求
  36. enable: false,
  37. },
  38. };
  39. // JWT config
  40. config.jwt = {
  41. ...jwt,
  42. expiresIn: '1d',
  43. issuer: 'article',
  44. };
  45. // add your config here
  46. config.cluster = {
  47. listen: {
  48. port: 10010,
  49. },
  50. };
  51. config.wxapi = {
  52. appid: 'wxdf3ed83c095be97a', // 微信公众号APPID
  53. appSecret: 'd85dbe075c090cb12ce416bbda8e698c',
  54. baseUrl: 'http://wx.cc-lotus.info', // 微信网关地址
  55. };
  56. return {
  57. ...config,
  58. ...userConfig,
  59. };
  60. };