config.default.js 2.0 KB

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