config.default.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. 'use strict';
  2. // 默认配置-服务器
  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: 12111,
  29. },
  30. };
  31. // 数据库设置
  32. config.dbName = 'point_shopping';
  33. config.mongoose = {
  34. url: `mongodb://127.0.0.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: '127.0.0.1', // Redis host
  56. password: '123456',
  57. db: 1,
  58. },
  59. };
  60. // mq设置
  61. config.amqp = {
  62. client: {
  63. hostname: '127.0.0.1',
  64. username: 'tehq',
  65. password: 'tehq',
  66. vhost: 'tehq',
  67. },
  68. app: true,
  69. agent: true,
  70. };
  71. // 定时任务机制设置
  72. config.taskMqConfig = {
  73. ex: 'task',
  74. queue: 'task',
  75. routingKey: 'tr',
  76. deadEx: 'deadTask',
  77. deadQueue: 'deadTaskQueue',
  78. deadLetterRoutingKey: 'deadTr',
  79. };
  80. config.msgEx = 't_m';
  81. // 路由设置
  82. config.routePrefix = '/point/v1/api';
  83. // 支付路由回调设置
  84. config.payReturn = {
  85. order: '/point/v1/api/pay/order',
  86. };
  87. // http请求前缀
  88. config.httpPrefix = {
  89. // wechat: 'http://127.0.0.1:14001/wechat/api',
  90. wechat: 'https://broadcast.waityou24.cn/wechat/api',
  91. // email: 'http://broadcast.waityou24.cn/semail/api',
  92. email: 'http://127.0.0.1:14002/semail/api',
  93. sms: 'http://127.0.0.1:14003/sms/api',
  94. };
  95. config.emailConfig = {
  96. config: 'tehq',
  97. };
  98. config.smsConfig = {
  99. config: 'tehq',
  100. };
  101. // 中间件
  102. config.requestLog = {
  103. toMongoDB: true,
  104. };
  105. config.redisKey = {
  106. orderKeyPrefix: 'orderKey:',
  107. };
  108. config.redisTimeout = 3600;
  109. config.errcode = {
  110. groupJoinRefund: -111,
  111. };
  112. config.wxPayConfig = 'tehqApp';
  113. config.logger = {
  114. level: 'NONE',
  115. };
  116. config.projects = [ 'group-service', 'service-point_shop' ]; // 协作项目:团购服务,尊荣服务
  117. return {
  118. ...config,
  119. ...userConfig,
  120. };
  121. };