config.default.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* eslint valid-jsdoc: "off" */
  2. 'use strict';
  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/zr/v1/api';
  12. const email_smsConfig = 'shoppingOne';
  13. const appSign = 'shoppingOneApp';
  14. const { jwt } = require('./config.secret');
  15. module.exports = appInfo => {
  16. /**
  17. * built-in config
  18. * @type {Egg.EggAppConfig}
  19. **/
  20. const config = (exports = {});
  21. // use for cookie sign key, should change to your own and keep security
  22. config.keys = appInfo.name + '_1666686710616_3993';
  23. config.appName = '商城-服务';
  24. // add your middleware config here
  25. config.middleware = [ 'setUserFromToken' ];
  26. config.checkToken = {
  27. enable: false,
  28. };
  29. // 进程设置
  30. config.cluster = {
  31. listen: {
  32. port: 12212,
  33. },
  34. };
  35. // 数据库设置
  36. config.mongoose = {
  37. url: `mongodb://${ip}:27017/${dbName}`, // 120.48.146.1 127.0.0.1
  38. options: {
  39. user: 'admin',
  40. pass: 'admin',
  41. authSource: 'admin',
  42. useNewUrlParser: true,
  43. useCreateIndex: true,
  44. useFindAndModify: true,
  45. allowDiskUse: true,
  46. },
  47. };
  48. // redis设置
  49. config.redis = {
  50. client: {
  51. port: 6379, // Redis port
  52. host: ip, // Redis host
  53. password: redisPwd,
  54. db: redisDB,
  55. },
  56. };
  57. // mq设置
  58. config.amqp = {
  59. client: {
  60. hostname: ip,
  61. username: mqUser,
  62. password: mqUser,
  63. vhost: mqUser,
  64. },
  65. app: true,
  66. agent: true,
  67. };
  68. // jwt设置
  69. config.jwt = {
  70. ...jwt,
  71. expiresIn: '1d',
  72. issuer: 'shopping',
  73. };
  74. // 路由设置
  75. config.routePrefix = routePrefix;
  76. config.emailConfig = {
  77. config: email_smsConfig,
  78. };
  79. config.smsConfig = {
  80. config: email_smsConfig,
  81. };
  82. // 中间件
  83. config.requestLog = {
  84. toMongoDB: true,
  85. };
  86. config.redisKey = {
  87. orderKeyPrefix: 'zrOrderKey:',
  88. };
  89. config.redisTimeout = 3600;
  90. config.wxPayConfig = appSign;
  91. // add your user config here
  92. const userConfig = {
  93. // myAppName: 'egg',
  94. };
  95. return {
  96. ...config,
  97. ...userConfig,
  98. };
  99. };