config.default.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* eslint valid-jsdoc: "off" */
  2. 'use strict';
  3. const { jwt } = require('./config.secret');
  4. /**
  5. * @param {Egg.EggAppInfo} appInfo app info
  6. */
  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 + '_1579225760252_7743';
  15. // add your middleware config here
  16. config.middleware = [];
  17. // add your user config here
  18. const userConfig = {
  19. // myAppName: 'egg',
  20. };
  21. // add your config here
  22. config.cluster = {
  23. listen: {
  24. port: 9008,
  25. },
  26. };
  27. // axios service config
  28. config.axios = {
  29. auth: { // 用户鉴权服务
  30. baseUrl: 'http://localhost:9999/api/auth/user',
  31. },
  32. };
  33. config.mongoose = {
  34. url: 'mongodb://localhost:27017/platform',
  35. options: {
  36. // user: 'admin',
  37. // pass: 'admin',
  38. // authSource: 'admin',
  39. // useNewUrlParser: true,
  40. // useCreateIndex: true,
  41. // useUnifiedTopology: true,
  42. },
  43. };
  44. // config.amqp = {
  45. // client: {
  46. // hostname: '127.0.0.1',
  47. // username: 'visit',
  48. // password: 'visit',
  49. // vhost: 'platform',
  50. // },
  51. // app: true,
  52. // agent: true,
  53. // };
  54. // // JWT config
  55. config.jwt = {
  56. ...jwt,
  57. expiresIn: '1d',
  58. issuer: 'jobs',
  59. };
  60. // redis config
  61. config.redis = {
  62. client: {
  63. port: 6379, // Redis port
  64. host: '127.0.0.1', // Redis host
  65. password: 123456,
  66. db: 0,
  67. },
  68. };
  69. config.session = {
  70. maxAge: 1000 * 60 * 30, // 30=>30min
  71. renew: true,
  72. };
  73. return {
  74. ...config,
  75. ...userConfig,
  76. };
  77. };