config.default.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 = [ '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. // http请求前缀
  44. config.httpPrefix = {
  45. base: 'http://127.0.0.1/api/live/v1',
  46. logs: 'http://localhost:13002/freeAdminLog/api',
  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: 0,
  55. },
  56. };
  57. // 进程设置
  58. config.cluster = {
  59. listen: {
  60. port: 9302,
  61. },
  62. };
  63. // jwt设置
  64. config.jwt = {
  65. ...jwt,
  66. expiresIn: '1d',
  67. issuer: 'platform-v1',
  68. };
  69. // 数据库设置
  70. config.dbName = 'platform-achieve-v1';
  71. config.mongoose = {
  72. url: `mongodb://localhost:27017/${config.dbName}`,
  73. options: {
  74. user: 'admin',
  75. pass: 'admin',
  76. authSource: 'admin',
  77. useNewUrlParser: true,
  78. useCreateIndex: true,
  79. },
  80. };
  81. // 路由设置
  82. config.routePrefix = '/api/achieve/v1';
  83. // 中间件
  84. config.requestLog = {
  85. toMongoDB: false,
  86. };
  87. config.module = 'achieve';
  88. return {
  89. ...config,
  90. ...userConfig,
  91. };
  92. };