config.default.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* eslint valid-jsdoc: "off" */
  2. 'use strict';
  3. /**
  4. * @param {Egg.EggAppInfo} appInfo app info
  5. */
  6. const { jwt } = require('./config.secret');
  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 + '_1664237342649_2194';
  15. // add your middleware config here
  16. config.middleware = [ 'setUserFromToken', 'checkLogin' ]; // , 'checkLogin'
  17. // add your user config here
  18. const userConfig = {
  19. // myAppName: 'egg',
  20. };
  21. config.checkToken = {
  22. enable: false,
  23. };
  24. // 进程设置
  25. config.cluster = {
  26. listen: {
  27. port: 12111,
  28. },
  29. };
  30. // 数据库设置
  31. config.dbName = 'point_shopping';
  32. config.mongoose = {
  33. url: `mongodb://120.48.146.1:27017/${config.dbName}`, // 120.48.146.1 127.0.0.1
  34. options: {
  35. user: 'admin',
  36. pass: 'admin',
  37. authSource: 'admin',
  38. useNewUrlParser: true,
  39. useCreateIndex: true,
  40. useFindAndModify: true,
  41. },
  42. };
  43. // jwt设置
  44. config.jwt = {
  45. ...jwt,
  46. expiresIn: '1d',
  47. issuer: 'shopping',
  48. };
  49. // redis设置
  50. config.redis = {
  51. client: {
  52. port: 6379, // Redis port
  53. host: '127.0.0.1', // Redis host
  54. password: '123456',
  55. db: 1,
  56. },
  57. };
  58. // 路由设置
  59. config.routePrefix = '/point/v1/api';
  60. // 支付路由回调设置
  61. config.payReturn = {
  62. order: id => `/point/v1/api/pay/order/${id}`,
  63. };
  64. // http请求前缀
  65. config.httpPrefix = {
  66. // wechat: 'http://127.0.0.1:14001/wechat/api',
  67. wechat: 'https://broadcast.waityou24.cn/wechat/api',
  68. // email: 'http://broadcast.waityou24.cn/semail/api',
  69. email: 'http://127.0.0.1:14002/semail/api',
  70. sms: 'http://127.0.0.1:14003/sms/api',
  71. };
  72. config.emailConfig = {
  73. config: 'free',
  74. };
  75. config.smsConfig = {
  76. config: 'free',
  77. };
  78. // 中间件
  79. config.requestLog = {
  80. toMongoDB: true,
  81. };
  82. config.redisKey = {
  83. orderKeyPrefix: 'orderKey:',
  84. };
  85. config.redisTimeout = 3600;
  86. config.errcode = {
  87. groupJoinRefund: -111,
  88. };
  89. return {
  90. ...config,
  91. ...userConfig,
  92. };
  93. };