config.default.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 + '_1587024572540_7742';
  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: 'admin',
  31. pass: 'admin',
  32. authSource: 'admin',
  33. useNewUrlParser: true,
  34. useCreateIndex: true,
  35. useUnifiedTopology: true,
  36. },
  37. };
  38. // redis config
  39. config.redis = {
  40. client: {
  41. port: 6379, // Redis port
  42. host: '127.0.0.1', // Redis host
  43. password: 123456,
  44. db: 0,
  45. },
  46. };
  47. // 安全配置
  48. config.security = {
  49. csrf: {
  50. // ignoreJSON: true, // 默认为 false,当设置为 true 时,将会放过所有 content-type 为 `application/json` 的请求
  51. enable: false,
  52. },
  53. };
  54. // // JWT config
  55. config.jwt = {
  56. ...jwt,
  57. expiresIn: '1d',
  58. issuer: 'jobs',
  59. };
  60. return {
  61. ...config,
  62. ...userConfig,
  63. };
  64. };