config.default.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 + '_1664237342649_2194';
  15. // add your middleware config here
  16. config.middleware = [ 'setUserFromToken' ]; // , '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://120.48.146.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. },
  41. };
  42. // jwt设置
  43. config.jwt = {
  44. ...jwt,
  45. expiresIn: '1d',
  46. issuer: 'shopping',
  47. };
  48. // redis设置
  49. config.redis = {
  50. client: {
  51. port: 6379, // Redis port
  52. host: '127.0.0.1', // Redis host
  53. password: '123456',
  54. db: 1,
  55. },
  56. };
  57. // 路由设置
  58. config.routePrefix = '/point/v1/api';
  59. // 中间件
  60. config.requestLog = {
  61. toMongoDB: true,
  62. };
  63. config.redisKey = {
  64. orderKeyPrefix: 'orderKey:',
  65. };
  66. config.redisTimeout = 3600;
  67. return {
  68. ...config,
  69. ...userConfig,
  70. };
  71. };