config.default.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* eslint valid-jsdoc: "off" */
  2. 'use strict';
  3. /**
  4. * @param {Egg.EggAppInfo} appInfo app info
  5. */
  6. module.exports = appInfo => {
  7. /**
  8. * built-in config
  9. * @type {Egg.EggAppConfig}
  10. **/
  11. const config = exports = {};
  12. // use for cookie sign key, should change to your own and keep security
  13. config.keys = appInfo.name + '_1637194502813_3847';
  14. // add your middleware config here
  15. config.middleware = [];
  16. // add your user config here
  17. const userConfig = {
  18. // myAppName: 'egg',
  19. };
  20. // 安全配置
  21. config.security = {
  22. csrf: {
  23. // ignoreJSON: true, // 默认为 false,当设置为 true 时,将会放过所有 content-type 为 `application/json` 的请求
  24. enable: false,
  25. },
  26. };
  27. config.cluster = {
  28. listen: {
  29. port: 18095,
  30. },
  31. };
  32. // 数据库配置
  33. config.mongoose = {
  34. url: 'mongodb://127.0.0.1/Microservices',
  35. options: {
  36. user: 'root',
  37. pass: 'Ziyouyanfa#@!',
  38. authSource: 'admin',
  39. useNewUrlParser: true,
  40. useCreateIndex: true,
  41. },
  42. };
  43. config.redis = {
  44. client: {
  45. port: 6389,
  46. // port: 6379,
  47. host: '127.0.0.1',
  48. password: null,
  49. db: 0,
  50. },
  51. };
  52. config.jwt = {
  53. issuer: 'naf',
  54. expiresIn: '12h',
  55. secret: '123456',
  56. };
  57. config.wxconfig = {
  58. appid: 'wx545cae03cce08392',
  59. appsecret: '5b90761f94b1b26b5119298f661765ba',
  60. };
  61. config.view = {
  62. defaultViewEngine: 'nunjucks',
  63. mapping: {
  64. '.njk': 'nunjucks',
  65. },
  66. };
  67. // 禁止登录次数
  68. config.ban = 3;
  69. // 禁止登录时间
  70. config.bantime = 60 * 5;
  71. config.logger = {
  72. level: 'DEBUG',
  73. };
  74. return {
  75. ...config,
  76. ...userConfig,
  77. };
  78. };