config.default.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. config.appName = '天恩活泉商城-服务';
  16. // add your middleware config here
  17. config.middleware = [ 'errorEmail', 'setUserFromToken', 'checkLogin', 'checkUserRK' ]; // , 'checkLogin'
  18. // add your user config here
  19. const userConfig = {
  20. // myAppName: 'egg',
  21. };
  22. config.checkToken = {
  23. enable: false,
  24. };
  25. // 进程设置
  26. config.cluster = {
  27. listen: {
  28. port: 12211,
  29. },
  30. };
  31. // 数据库设置
  32. config.dbName = 'point_shopping-dev';
  33. config.mongoose = {
  34. url: `mongodb://120.48.146.1:27017/${config.dbName}`, // 120.48.146.1 127.0.0.1
  35. options: {
  36. user: 'admin',
  37. pass: 'admin',
  38. authSource: 'admin',
  39. useNewUrlParser: true,
  40. useCreateIndex: true,
  41. useFindAndModify: true,
  42. allowDiskUse: true,
  43. },
  44. };
  45. // jwt设置
  46. config.jwt = {
  47. ...jwt,
  48. expiresIn: '1d',
  49. issuer: 'shopping',
  50. };
  51. // redis设置
  52. config.redis = {
  53. client: {
  54. port: 6379, // Redis port
  55. host: '120.48.146.1', // Redis host
  56. password: '123456',
  57. db: 2,
  58. },
  59. };
  60. // mq设置
  61. config.amqp = {
  62. client: {
  63. hostname: '120.48.146.1',
  64. username: 'tehqDev',
  65. password: 'tehqDev',
  66. vhost: 'tehqDev',
  67. },
  68. app: true,
  69. agent: true,
  70. };
  71. // 定时任务机制设置
  72. config.taskMqConfig = {
  73. ex: 'taskDevLocal',
  74. queue: 'taskDevLocal',
  75. routingKey: 'trDevLocal',
  76. deadEx: 'deadTaskDevLocal',
  77. deadQueue: 'deadTaskQueueDevLocal',
  78. deadLetterRoutingKey: 'deadTrDevLocal',
  79. };
  80. // 路由设置
  81. config.routePrefix = '/dev/point/v1/api';
  82. // 支付路由回调设置
  83. config.payReturn = {
  84. order: '/dev/point/v1/api/pay/order',
  85. };
  86. // http请求前缀
  87. config.httpPrefix = {
  88. wechat: 'http://127.0.0.1:14001/wechat/api',
  89. // wechat: 'https://broadcast.waityou24.cn/wechat/api',
  90. // email: 'http://broadcast.waityou24.cn/semail/api',
  91. email: 'http://127.0.0.1:14002/semail/api',
  92. sms: 'http://127.0.0.1:14003/sms/api',
  93. };
  94. config.emailConfig = {
  95. config: 'free',
  96. };
  97. config.smsConfig = {
  98. config: 'free',
  99. };
  100. // 中间件
  101. config.requestLog = {
  102. toMongoDB: true,
  103. };
  104. config.redisKey = {
  105. orderKeyPrefix: 'orderKey:',
  106. };
  107. config.redisTimeout = 3600;
  108. config.errcode = {
  109. groupJoinRefund: -111,
  110. };
  111. config.wxPayConfig = 'pointApp';
  112. return {
  113. ...config,
  114. ...userConfig,
  115. };
  116. };