config.default.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* eslint valid-jsdoc: "off" */
  2. 'use strict';
  3. const { jwt } = require('./config.secret');
  4. const { sep } = require('path');
  5. /**
  6. * @param {Egg.EggAppInfo} appInfo app info
  7. */
  8. module.exports = appInfo => {
  9. /**
  10. * built-in config
  11. * @type {Egg.EggAppConfig}
  12. **/
  13. const config = (exports = {});
  14. // use for cookie sign key, should change to your own and keep security
  15. config.keys = appInfo.name + '_1590486343297_6167';
  16. // add your middleware config here
  17. config.middleware = [];
  18. // add your user config here
  19. const userConfig = {
  20. // myAppName: 'egg',
  21. };
  22. // add your config here
  23. config.cluster = {
  24. listen: {
  25. port: 3001,
  26. },
  27. };
  28. // mq配置
  29. config.amqp = {
  30. client: {
  31. hostname: '127.0.0.1',
  32. username: 'visit',
  33. password: 'visit',
  34. vhost: 'visit',
  35. },
  36. app: true,
  37. agent: true,
  38. };
  39. config.dataDir = `${appInfo.baseDir}${sep}data`;
  40. // mongoose config
  41. config.mongoose = {
  42. url: 'mongodb://localhost:27017/count',
  43. // options: {
  44. // user: 'admin',
  45. // pass: 'admin',
  46. // authSource: 'admin',
  47. // useNewUrlParser: true,
  48. // useCreateIndex: true,
  49. // },
  50. };
  51. // // JWT config
  52. config.jwt = {
  53. ...jwt,
  54. expiresIn: '1d',
  55. issuer: 'count',
  56. };
  57. config.redis = {
  58. client: {
  59. port: 6379, // Redis port
  60. host: '127.0.0.1', // Redis host
  61. password: '',
  62. db: 2,
  63. },
  64. };
  65. return {
  66. ...config,
  67. ...userConfig,
  68. };
  69. };