config.default.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 + '_1666686710616_3993';
  15. config.appName = '天恩活泉商城-服务';
  16. // add your middleware config here
  17. config.middleware = [ 'setUserFromToken' ];
  18. config.checkToken = {
  19. enable: false,
  20. };
  21. // 进程设置
  22. config.cluster = {
  23. listen: {
  24. port: 12112,
  25. },
  26. };
  27. // 数据库设置
  28. config.dbName = 'point_shopping';
  29. config.mongoose = {
  30. url: `mongodb://120.48.146.1:27017/${config.dbName}`, // 120.48.146.1 127.0.0.1
  31. options: {
  32. user: 'admin',
  33. pass: 'admin',
  34. authSource: 'admin',
  35. useNewUrlParser: true,
  36. useCreateIndex: true,
  37. useFindAndModify: true,
  38. allowDiskUse: true,
  39. },
  40. };
  41. // jwt设置
  42. config.jwt = {
  43. ...jwt,
  44. expiresIn: '1d',
  45. issuer: 'shopping',
  46. };
  47. // 路由设置
  48. config.routePrefix = '/point/zr/v1/api';
  49. config.emailConfig = {
  50. config: 'free',
  51. };
  52. config.smsConfig = {
  53. config: 'free',
  54. };
  55. // 中间件
  56. config.requestLog = {
  57. toMongoDB: true,
  58. };
  59. config.redisKey = {
  60. orderKeyPrefix: 'zrOrderKey:',
  61. };
  62. config.redisTimeout = 3600;
  63. config.wxPayConfig = 'pointApp';
  64. // add your user config here
  65. const userConfig = {
  66. // myAppName: 'egg',
  67. };
  68. return {
  69. ...config,
  70. ...userConfig,
  71. };
  72. };