config.default.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. // redis config
  33. config.redis = {
  34. client: {
  35. port: 6379, // Redis port
  36. host: '127.0.0.1', // Redis host
  37. password: 123456,
  38. db: 0,
  39. },
  40. };
  41. // 安全配置
  42. config.security = {
  43. csrf: {
  44. // ignoreJSON: true, // 默认为 false,当设置为 true 时,将会放过所有 content-type 为 `application/json` 的请求
  45. enable: false,
  46. },
  47. };
  48. // JWT config
  49. config.jwt = {
  50. ...jwt,
  51. expiresIn: '1d',
  52. issuer: 'article',
  53. };
  54. // add your config here
  55. config.cluster = {
  56. listen: {
  57. port: 10010,
  58. },
  59. };
  60. config.wxapi = {
  61. appid: 'wxdf3ed83c095be97a', // 微信公众号APPID
  62. appSecret: 'd85dbe075c090cb12ce416bbda8e698c',
  63. baseUrl: 'http://wx.cc-lotus.info', // 微信网关地址
  64. };
  65. return {
  66. ...config,
  67. ...userConfig,
  68. };
  69. };