config.default.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. logs: 'http://localhost:13010/achieveAdmin/api',
  46. };
  47. // redis设置
  48. // config.redis = {
  49. // client: {
  50. // port: 6379, // Redis port
  51. // host: '127.0.0.1', // Redis host
  52. // password: '123456',
  53. // db: 0,
  54. // },
  55. // };
  56. // 进程设置
  57. config.cluster = {
  58. listen: {
  59. port: 13011,
  60. },
  61. };
  62. // jwt设置
  63. config.jwt = {
  64. ...jwt,
  65. expiresIn: '1d',
  66. issuer: 'achieveAdmin',
  67. };
  68. // 数据库设置
  69. config.dbName = 'achieveAdmin';
  70. config.mongoose = {
  71. url: `mongodb://localhost:27017/${config.dbName}`,
  72. options: {
  73. user: 'admin',
  74. pass: 'admin',
  75. authSource: 'admin',
  76. useNewUrlParser: true,
  77. useCreateIndex: true,
  78. },
  79. };
  80. // 路由设置
  81. config.routePrefix = '/achieveAdmin/api';
  82. // 中间件
  83. config.requestLog = {
  84. toMongoDB: true,
  85. };
  86. // config.module = 'user';
  87. return {
  88. ...config,
  89. ...userConfig,
  90. };
  91. };