config.default.js 2.1 KB

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