config.default.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 + '_1571378739964_3623';
  15. // add your middleware config here
  16. config.middleware = [];
  17. // add your user config here
  18. const userConfig = {
  19. // myAppName: 'egg',
  20. };
  21. config.errorMongo = {
  22. details: true,
  23. };
  24. config.errorHanler = {
  25. details: true,
  26. };
  27. // add your config here
  28. config.cluster = {
  29. listen: {
  30. port: 8103,
  31. },
  32. };
  33. // mongoose config
  34. // config.mongoose = {
  35. // url: 'mongodb://127.0.0.1:27017/smart',
  36. // options: {
  37. // user: 'root',
  38. // pass: 'Ziyouyanfa#@!',
  39. // authSource: 'admin',
  40. // useNewUrlParser: true,
  41. // useCreateIndex: true,
  42. // },
  43. // };
  44. config.mongoose = {
  45. url: 'mongodb://localhost:27017/smart',
  46. options: {
  47. user: 'demo',
  48. pass: 'demo',
  49. authSource: 'admin',
  50. useNewUrlParser: true,
  51. useCreateIndex: true,
  52. useUnifiedTopology: true,
  53. },
  54. };
  55. // JWT config
  56. config.jwt = {
  57. ...jwt,
  58. expiresIn: '1d',
  59. issuer: 'jobs',
  60. };
  61. return {
  62. ...config,
  63. ...userConfig,
  64. };
  65. };