config.default.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. 'use strict';
  2. // 默认配置
  3. /**
  4. * @param {Egg.EggAppInfo} appInfo app info
  5. */
  6. const ip = '192.168.1.197';
  7. const dbName = 'shoppingOne-dev';
  8. const redisPwd = '';
  9. const redisDB = 3;
  10. const mqUser = 'shoppingOneDev';
  11. const routePrefix = '/dev/point/one/v1/api';
  12. const payReturn = '/dev/point/one/v1/api/pay/order';
  13. const email_smsConfig = 'shoppingOne';
  14. const appSign = 'shoppingOne';
  15. const { jwt } = require('./config.secret');
  16. module.exports = appInfo => {
  17. /**
  18. * built-in config
  19. * @type {Egg.EggAppConfig}
  20. **/
  21. const config = (exports = {});
  22. // use for cookie sign key, should change to your own and keep security
  23. config.keys = appInfo.name + '_1664237342649_2194';
  24. config.appName = '商城-服务';
  25. // add your middleware config here
  26. config.middleware = [ 'errorEmail', 'setUserFromToken', 'checkLogin', 'checkUserRK' ]; // , 'checkLogin'
  27. // add your user config here
  28. const userConfig = {
  29. // myAppName: 'egg',
  30. };
  31. config.checkToken = {
  32. enable: false,
  33. };
  34. // 进程设置
  35. config.cluster = {
  36. listen: {
  37. port: 12211,
  38. },
  39. };
  40. // 数据库设置
  41. config.mongoose = {
  42. url: 'mongodb://120.48.146.1:27017/shoppingOne', // 120.48.146.1 127.0.0.1
  43. options: {
  44. user: 'admin',
  45. pass: 'admin',
  46. authSource: 'admin',
  47. useNewUrlParser: true,
  48. useCreateIndex: true,
  49. useFindAndModify: true,
  50. allowDiskUse: true,
  51. },
  52. };
  53. // jwt设置
  54. config.jwt = {
  55. ...jwt,
  56. expiresIn: '1d',
  57. issuer: 'shopping',
  58. };
  59. // redis设置
  60. config.redis = {
  61. client: {
  62. port: 6379, // Redis port
  63. host: ip, // Redis host
  64. password: redisPwd,
  65. db: redisDB,
  66. },
  67. };
  68. // mq设置
  69. config.amqp = {
  70. client: {
  71. hostname: ip,
  72. username: mqUser,
  73. password: mqUser,
  74. vhost: mqUser,
  75. },
  76. app: true,
  77. agent: true,
  78. };
  79. // 定时任务机制设置
  80. config.taskMqConfig = {
  81. ex: 'task',
  82. queue: 'task',
  83. routingKey: 'tr',
  84. deadEx: 'deadTask',
  85. deadQueue: 'deadTaskQueue',
  86. deadLetterRoutingKey: 'deadTr',
  87. };
  88. config.msgEx = 't_m';
  89. // 路由设置
  90. config.routePrefix = routePrefix;
  91. // 支付路由回调设置
  92. config.payReturn = {
  93. order: payReturn,
  94. };
  95. // http请求前缀
  96. config.httpPrefix = {
  97. wechat: 'https://broadcast.waityou24.cn/wechat/api',
  98. email: 'http://127.0.0.1:14002/semail/api',
  99. sms: 'http://127.0.0.1:14003/sms/api',
  100. };
  101. config.emailConfig = {
  102. config: email_smsConfig,
  103. };
  104. config.smsConfig = {
  105. config: email_smsConfig,
  106. };
  107. // 中间件
  108. config.requestLog = {
  109. toMongoDB: true,
  110. };
  111. config.redisKey = {
  112. orderKeyPrefix: 'orderKey:',
  113. };
  114. config.redisTimeout = 3600;
  115. config.errcode = {
  116. groupJoinRefund: -111,
  117. };
  118. config.wxPayConfig = appSign;
  119. config.logger = {
  120. level: 'NONE',
  121. };
  122. config.projects = [ 'group-service', 'service-point_shop' ]; // 协作项目:团购服务,尊荣服务
  123. return {
  124. ...config,
  125. ...userConfig,
  126. };
  127. };