config.default.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 = [ 'turnResponse' ];
  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. // 发送队列名称
  27. // config.sendQueue = {
  28. // logs: 'freeAdmin/server-logs',
  29. // };
  30. // http请求前缀
  31. config.httpPrefix = {
  32. logs: 'http://localhost:13002/freeAdminLog/api',
  33. };
  34. // redis设置
  35. // config.redis = {
  36. // client: {
  37. // port: 6379, // Redis port
  38. // host: '127.0.0.1', // Redis host
  39. // password: '123456',
  40. // db: 0,
  41. // },
  42. // };
  43. // 进程设置
  44. config.cluster = {
  45. listen: {
  46. port: 13001,
  47. },
  48. };
  49. // jwt设置
  50. config.jwt = {
  51. ...jwt,
  52. expiresIn: '1d',
  53. issuer: 'lab',
  54. };
  55. // 数据库设置
  56. config.dbName = 'label-achievement';
  57. config.mongoose = {
  58. url: `mongodb://localhost:27017/${config.dbName}`,
  59. options: {
  60. user: 'admin',
  61. pass: 'admin',
  62. authSource: 'admin',
  63. useNewUrlParser: true,
  64. useCreateIndex: true,
  65. },
  66. };
  67. // mysql
  68. config.mysql = {
  69. client: {
  70. // host
  71. host: 'localhost',
  72. // 端口号
  73. port: '3307',
  74. // 用户名
  75. user: 'root',
  76. // 密码
  77. password: 'root',
  78. // 数据库名
  79. database: 'management_platform',
  80. },
  81. // 是否加载到 app 上,默认开启
  82. app: true,
  83. // 是否加载到 agent 上,默认关闭
  84. agent: false,
  85. };
  86. // 路由设置
  87. config.routePrefix = '/labelAchievement/api';
  88. // 中间件
  89. config.requestLog = {
  90. toMongoDB: true,
  91. };
  92. return {
  93. ...config,
  94. ...userConfig,
  95. };
  96. };