config.default.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 + '_1604310853516_4870';
  15. // add your middleware config here
  16. config.middleware = [];
  17. // add your user config here
  18. const userConfig = {
  19. // myAppName: 'egg',
  20. };
  21. config.cluster = {
  22. listen: {
  23. port: 4000,
  24. },
  25. };
  26. // mq配置
  27. config.amqp = {
  28. client: {
  29. hostname: '127.0.0.1',
  30. username: 'visit',
  31. password: 'visit',
  32. vhost: 'train',
  33. },
  34. app: true,
  35. agent: true,
  36. };
  37. // redis config
  38. config.redis = {
  39. client: {
  40. port: 6379, // Redis port
  41. host: '127.0.0.1', // Redis host
  42. password: '',
  43. db: 0,
  44. },
  45. };
  46. // mongoose config
  47. config.mongoose = {
  48. url: 'mongodb://127.0.0.1:27017/auth',
  49. options: {
  50. // user: 'admin',
  51. // pass: 'admin',
  52. // authSource: 'admin',
  53. useNewUrlParser: true,
  54. useCreateIndex: true,
  55. },
  56. };
  57. config.project = {
  58. center: 'http://127.0.0.1:2001',
  59. };
  60. // 安全配置
  61. config.security = {
  62. csrf: {
  63. // ignoreJSON: true, // 默认为 false,当设置为 true 时,将会放过所有 content-type 为 `application/json` 的请求
  64. enable: false,
  65. },
  66. };
  67. config.jwt = {
  68. ...jwt,
  69. expiresIn: '1d',
  70. issuer: 'servicezhwl',
  71. };
  72. return {
  73. ...config,
  74. ...userConfig,
  75. };
  76. };