config.default.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 = [];
  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. return {
  64. ...config,
  65. ...userConfig,
  66. };
  67. };