config.default.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 + '_1640765284662_2781';
  15. // add your middleware config here
  16. config.middleware = [ 'checkToken', 'requestLog' ];
  17. // add your user config here
  18. const userConfig = {
  19. // myAppName: 'egg',
  20. };
  21. // 日志
  22. config.logger = {
  23. level: 'DEBUG',
  24. allowDebugAtProd: true,
  25. };
  26. // mq设置
  27. config.amqp = {
  28. client: {
  29. hostname: '127.0.0.1',
  30. username: 'freeAdmin',
  31. password: '1qaz2wsx',
  32. vhost: 'freeAdmin',
  33. },
  34. app: true,
  35. agent: true,
  36. };
  37. // 接收队列名称
  38. config.queue = 'freeAdmin/server-user';
  39. // 发送队列名称
  40. config.sendQueue = {
  41. logs: 'freeAdmin/server-logs',
  42. };
  43. // redis设置
  44. config.redis = {
  45. client: {
  46. port: 6379, // Redis port
  47. host: '127.0.0.1', // Redis host
  48. password: '123456',
  49. db: 0,
  50. },
  51. };
  52. // 进程设置
  53. config.cluster = {
  54. listen: {
  55. port: 13001,
  56. },
  57. };
  58. // jwt设置
  59. config.jwt = {
  60. ...jwt,
  61. expiresIn: '1d',
  62. issuer: 'freeAdmin',
  63. };
  64. // 数据库设置
  65. config.dbName = 'freeAdmin';
  66. config.mongoose = {
  67. url: `mongodb://localhost:27017/${config.dbName}`,
  68. options: {
  69. user: 'admin',
  70. pass: 'admin',
  71. authSource: 'admin',
  72. useNewUrlParser: true,
  73. useCreateIndex: true,
  74. },
  75. };
  76. // 路由设置
  77. config.routePrefix = '/freeAdmin/api';
  78. // 中间件
  79. config.requestLog = {
  80. toMongoDB: true,
  81. };
  82. config.module = 'user';
  83. return {
  84. ...config,
  85. ...userConfig,
  86. };
  87. };