config.default.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. 'use strict';
  2. /**
  3. * @param {Egg.EggAppInfo} appInfo app info
  4. */
  5. const { jwt } = require('./config.secret');
  6. module.exports = appInfo => {
  7. /**
  8. * built-in config
  9. * @type {Egg.EggAppConfig}
  10. **/
  11. const config = (exports = {});
  12. // use for cookie sign key, should change to your own and keep security
  13. config.keys = appInfo.name + '_1664237342649_2194';
  14. config.appName = '天恩活泉商城-服务';
  15. // add your middleware config here
  16. config.middleware = [ 'errorEmail', 'setUserFromToken', 'checkLogin', 'checkUserRK' ]; // , '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://127.0.0.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. allowDiskUse: true,
  42. },
  43. };
  44. // jwt设置
  45. config.jwt = {
  46. ...jwt,
  47. expiresIn: '1d',
  48. issuer: 'shopping',
  49. };
  50. // redis设置
  51. config.redis = {
  52. client: {
  53. port: 6379, // Redis port
  54. host: '127.0.0.1', // Redis host
  55. password: '123456',
  56. db: 1,
  57. },
  58. };
  59. // mq设置
  60. config.amqp = {
  61. client: {
  62. hostname: '127.0.0.1',
  63. username: 'tehq',
  64. password: 'tehq',
  65. vhost: 'tehq',
  66. },
  67. app: true,
  68. agent: true,
  69. };
  70. // 定时任务机制设置
  71. config.taskMqConfig = {
  72. ex: 'task',
  73. queue: 'task',
  74. routingKey: 'tr',
  75. deadEx: 'deadTask',
  76. deadQueue: 'deadTaskQueue',
  77. deadLetterRoutingKey: 'deadTr',
  78. };
  79. // 路由设置
  80. config.routePrefix = '/point/v1/api';
  81. // 支付路由回调设置
  82. config.payReturn = {
  83. order: '/dev/point/v1/api/pay/order',
  84. };
  85. // http请求前缀
  86. config.httpPrefix = {
  87. // wechat: 'http://127.0.0.1:14001/wechat/api',
  88. wechat: 'https://broadcast.waityou24.cn/wechat/api',
  89. // email: 'http://broadcast.waityou24.cn/semail/api',
  90. email: 'http://127.0.0.1:14002/semail/api',
  91. sms: 'http://127.0.0.1:14003/sms/api',
  92. };
  93. config.emailConfig = {
  94. config: 'tehq',
  95. };
  96. config.smsConfig = {
  97. config: 'tehq',
  98. };
  99. // 中间件
  100. config.requestLog = {
  101. toMongoDB: true,
  102. };
  103. config.redisKey = {
  104. orderKeyPrefix: 'orderKey:',
  105. };
  106. config.redisTimeout = 3600;
  107. config.errcode = {
  108. groupJoinRefund: -111,
  109. };
  110. config.wxPayConfig = 'tehqApp';
  111. return {
  112. ...config,
  113. ...userConfig,
  114. };
  115. };