config.default.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 + '_1578642242928_5726';
  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: 8001,
  31. },
  32. };
  33. // 服务器发布路径
  34. config.baseUrl = 'http://free.liaoningdoupo.com';
  35. // config.amqp = {
  36. // client: {
  37. // hostname: '127.0.0.1',
  38. // username: 'visit',
  39. // password: 'visit123',
  40. // vhost: 'visit',
  41. // },
  42. // app: true,
  43. // agent: true,
  44. // };
  45. // mongoose config
  46. config.mongoose = {
  47. url: 'mongodb://127.0.0.1:27017/visit',
  48. options: {
  49. user: 'admin',
  50. pass: 'admin',
  51. authSource: 'admin',
  52. useNewUrlParser: true,
  53. useCreateIndex: true,
  54. },
  55. };
  56. // 安全配置
  57. config.security = {
  58. csrf: {
  59. // ignoreJSON: true, // 默认为 false,当设置为 true 时,将会放过所有 content-type 为 `application/json` 的请求
  60. enable: false,
  61. },
  62. };
  63. // // JWT config
  64. config.jwt = {
  65. ...jwt,
  66. expiresIn: '1d',
  67. issuer: 'train',
  68. };
  69. return {
  70. ...config,
  71. ...userConfig,
  72. };
  73. };