config.default.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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: 'wx6db5d25b3e7cfc14', // 微信公众号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. // 项目之间的变量
  42. config.project = {
  43. market: 'http://localhost:9004/api/market',
  44. };
  45. config.mongoose = {
  46. url: 'mongodb://localhost:27017/platform',
  47. options: {
  48. // user: 'admin',
  49. // pass: 'admin',
  50. // authSource: 'admin',
  51. // useNewUrlParser: true,
  52. // useCreateIndex: true,
  53. // useUnifiedTopology: true,
  54. },
  55. };
  56. // redis config
  57. config.redis = {
  58. client: {
  59. port: 6379, // Redis port
  60. host: '127.0.0.1', // Redis host
  61. password: 123456,
  62. db: 0,
  63. },
  64. };
  65. // 安全配置
  66. config.security = {
  67. csrf: {
  68. // ignoreJSON: true, // 默认为 false,当设置为 true 时,将会放过所有 content-type 为 `application/json` 的请求
  69. enable: false,
  70. },
  71. };
  72. // // JWT config
  73. config.jwt = {
  74. ...jwt,
  75. expiresIn: '1d',
  76. issuer: 'jobs',
  77. };
  78. return {
  79. ...config,
  80. ...userConfig,
  81. };
  82. };