config.default.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 + '_1579225707794_7012';
  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: 9000,
  25. },
  26. };
  27. config.mongoose = {
  28. url: 'mongodb://localhost:27017/platform',
  29. options: {
  30. user: 'demo',
  31. pass: 'demo',
  32. authSource: 'admin',
  33. useNewUrlParser: true,
  34. useCreateIndex: true,
  35. useUnifiedTopology: true,
  36. },
  37. };
  38. // 安全配置
  39. config.security = {
  40. csrf: {
  41. // ignoreJSON: true, // 默认为 false,当设置为 true 时,将会放过所有 content-type 为 `application/json` 的请求
  42. enable: false,
  43. },
  44. };
  45. // // JWT config
  46. config.jwt = {
  47. ...jwt,
  48. expiresIn: '1d',
  49. issuer: 'jobs',
  50. };
  51. return {
  52. ...config,
  53. ...userConfig,
  54. };
  55. };