config.default.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 + '_1587024572540_7742';
  15. // add your middleware config here
  16. config.middleware = [];
  17. // add your user config here
  18. const userConfig = {
  19. // myAppName: 'egg',
  20. };
  21. // add your config here
  22. config.cluster = {
  23. listen: {
  24. port: 9999,
  25. },
  26. };
  27. config.wxapi = {
  28. appid: 'wxdf3ed83c095be97a', // 微信公众号APPID
  29. appSecret: '748df7c2a75077a79ae0c971b1638244',
  30. baseUrl: 'http://wx.cc-lotus.info', // 微信网关地址
  31. mchid: '1505364491', // 商户ID
  32. mchkey: '1qaz2wsx3edc4rfv5tgb6yhn7ujm8ik9', // 商户key
  33. wxurl: 'http://free.liaoningdoupo.com/api/wxpayback',
  34. payurl: 'https://api.mch.weixin.qq.com/pay/unifiedorder',
  35. };
  36. config.proxy = true;
  37. config.hostHeaders = 'x-forwarded-host';
  38. // 服务器发布路径
  39. config.baseUrl = 'http://free.liaoningdoupo.com';
  40. // 认证回调地址
  41. config.authUrl = '/api/auth/wxchat';
  42. config.mongoose = {
  43. url: 'mongodb://localhost:27017/platform',
  44. options: {
  45. user: 'admin',
  46. pass: 'admin',
  47. authSource: 'admin',
  48. useNewUrlParser: true,
  49. useCreateIndex: true,
  50. useUnifiedTopology: true,
  51. },
  52. };
  53. // redis config
  54. config.redis = {
  55. client: {
  56. port: 6379, // Redis port
  57. host: '127.0.0.1', // Redis host
  58. password: 123456,
  59. db: 0,
  60. },
  61. };
  62. // 安全配置
  63. config.security = {
  64. csrf: {
  65. // ignoreJSON: true, // 默认为 false,当设置为 true 时,将会放过所有 content-type 为 `application/json` 的请求
  66. enable: false,
  67. },
  68. };
  69. // // JWT config
  70. config.jwt = {
  71. ...jwt,
  72. expiresIn: '1d',
  73. issuer: 'jobs',
  74. };
  75. return {
  76. ...config,
  77. ...userConfig,
  78. };
  79. };