config.default.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. 'use strict';
  2. /**
  3. * @param {Egg.EggAppInfo} appInfo app info
  4. */
  5. const { jwt } = require('./config.secret');
  6. module.exports = appInfo => {
  7. /**
  8. * built-in config
  9. * @type {Egg.EggAppConfig}
  10. **/
  11. const config = (exports = {});
  12. config.keys = appInfo.name + '_1640765284662_2781';
  13. config.appName = '项目模板-服务';
  14. config.middleware = [ 'requestLog' ];
  15. // 日志
  16. config.logger = {
  17. level: 'DEBUG',
  18. allowDebugAtProd: true,
  19. };
  20. // http请求前缀
  21. config.httpPrefix = {
  22. logs: 'http://localhost:10001/projectadmin/api',
  23. };
  24. // 进程设置
  25. config.cluster = {
  26. listen: {
  27. port: 10002,
  28. },
  29. };
  30. // jwt设置
  31. config.jwt = {
  32. ...jwt,
  33. expiresIn: '1d',
  34. issuer: 'projectadmin',
  35. };
  36. // 数据库设置
  37. config.dbName = 'projectadmin';
  38. config.mongoose = {
  39. url: `mongodb://localhost:27017/${config.dbName}`,
  40. options: {
  41. user: 'admin',
  42. pass: 'admin',
  43. authSource: 'admin',
  44. useNewUrlParser: true,
  45. useCreateIndex: true,
  46. },
  47. };
  48. // 路由设置
  49. config.routePrefix = '/projectadmin/api';
  50. // 中间件
  51. config.requestLog = {
  52. toMongoDB: true,
  53. };
  54. config.module = 'user';
  55. return {
  56. ...config,
  57. };
  58. };