config.default.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* eslint valid-jsdoc: "off" */
  2. 'use strict';
  3. /**
  4. * @param {Egg.EggAppInfo} appInfo app info
  5. */
  6. const ip = '127.0.0.1';
  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 + '_1603878155652_3375';
  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: 7003,
  24. },
  25. };
  26. // mq配置
  27. config.amqp = {
  28. client: {
  29. hostname: ip,
  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: ip, // Redis host
  42. password: '123456',
  43. db: 0,
  44. },
  45. };
  46. // mongoose config
  47. config.mongoose = {
  48. url: 'mongodb://127.0.0.1:27017/train',
  49. options: {
  50. user: 'root',
  51. pass: 'root',
  52. authSource: 'admin',
  53. useNewUrlParser: true,
  54. useCreateIndex: true,
  55. },
  56. };
  57. config.project = {
  58. center: 'http://127.0.0.1:7001',
  59. };
  60. // 安全配置
  61. config.security = {
  62. csrf: {
  63. // ignoreJSON: true, // 默认为 false,当设置为 true 时,将会放过所有 content-type 为 `application/json` 的请求
  64. enable: false,
  65. },
  66. };
  67. return {
  68. ...config,
  69. ...userConfig,
  70. };
  71. };