config.default.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /* eslint valid-jsdoc: "off" */
  2. 'use strict';
  3. /**
  4. * @param {Egg.EggAppInfo} appInfo app info
  5. */
  6. const { jwt } = require('./config.secret');
  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 + '_1640765284662_2781';
  15. // add your middleware config here
  16. config.middleware = [ 'requestLog' ];
  17. // add your user config here
  18. const userConfig = {
  19. // myAppName: 'egg',
  20. };
  21. // 日志
  22. config.logger = {
  23. level: 'DEBUG',
  24. allowDebugAtProd: true,
  25. };
  26. // mq设置
  27. // config.amqp = {
  28. // client: {
  29. // hostname: '127.0.0.1',
  30. // username: 'freeAdmin',
  31. // password: '1qaz2wsx',
  32. // vhost: 'freeAdmin',
  33. // },
  34. // app: true,
  35. // agent: true,
  36. // };
  37. // 接收队列名称
  38. // config.queue = 'freeAdmin/server-haocai-new';
  39. // 发送队列名称
  40. // config.sendQueue = {
  41. // logs: 'freeAdmin/server-logs',
  42. // };
  43. // http请求前缀
  44. config.httpPrefix = {
  45. // wechat: 'http://127.0.0.1:14001/wechat/api',
  46. wechat: 'https://broadcast.waityou24.cn/wechat/api',
  47. };
  48. // 微信小程序消息模板
  49. config.msgTemplate = {
  50. exit: {
  51. template_id: 'XC1Is016sqt09_3PsyySYKFtwdrLUqggdn5qIvOiSNI',
  52. data: [
  53. { key: 'thing1', value: { value: '活动名称' } },
  54. { key: 'thing2', value: { value: '项目名称' } },
  55. { key: 'time3', value: { value: '申请时间' } },
  56. { key: 'amount4', value: { value: '退款金额' } },
  57. ],
  58. },
  59. enroll: {
  60. template_id: 'HClmobxtn7b4qunUBF5a5y68cwak8d7VSwqGY0vAx1U',
  61. data: [
  62. { key: 'thing1', value: { value: '比赛名称' } },
  63. { key: 'thing4', value: { value: '赛事类型' } },
  64. { key: 'thing5', value: { value: '参赛者姓名' } },
  65. { key: 'thing8', value: { value: '报名审核结果' } },
  66. { key: 'time2', value: { value: '报名时间' } },
  67. ],
  68. },
  69. remind: {
  70. template_id: 'cq3JPX9RMFdEGjH9dBn6n5P5CFCJJ9Q8LIljZlJgBlM',
  71. data: [
  72. { key: 'thing1', value: { value: '比赛名称' } },
  73. { key: 'thing2', value: { value: '比赛时间' } },
  74. { key: 'thing4', value: { value: '赛制' } },
  75. { key: 'thing7', value: { value: '比赛地点' } },
  76. { key: 'thing8', value: { value: '参赛选手' } },
  77. ],
  78. },
  79. };
  80. // redis设置
  81. // config.redis = {
  82. // client: {
  83. // port: 6379, // Redis port
  84. // host: '127.0.0.1', // Redis host
  85. // password: '123456',
  86. // db: 0,
  87. // },
  88. // };
  89. // 进程设置
  90. config.cluster = {
  91. listen: {
  92. port: 15001,
  93. },
  94. };
  95. // jwt设置
  96. config.jwt = {
  97. ...jwt,
  98. expiresIn: '1d',
  99. issuer: 'new_court',
  100. };
  101. // 数据库设置
  102. config.dbName = 'court_race_v2';
  103. config.baseDbName = 'court_v2';
  104. config.defaultModule = 'Race';
  105. config.mongoose = {
  106. clients: {
  107. base: {
  108. url: `mongodb://120.48.146.1:27017/${config.baseDbName}`, // 120.48.146.1 127.0.0.1
  109. options: {
  110. user: 'admin',
  111. pass: 'admin',
  112. authSource: 'admin',
  113. useNewUrlParser: true,
  114. useCreateIndex: true,
  115. },
  116. },
  117. race: {
  118. url: `mongodb://120.48.146.1:27017/${config.dbName}`, // 120.48.146.1 127.0.0.1
  119. options: {
  120. user: 'admin',
  121. pass: 'admin',
  122. authSource: 'admin',
  123. useNewUrlParser: true,
  124. useCreateIndex: true,
  125. },
  126. },
  127. },
  128. };
  129. // 路由设置
  130. config.routePrefix = '/newCourt/race/v2/api';
  131. // 中间件
  132. config.requestLog = {
  133. toMongoDB: true,
  134. };
  135. return {
  136. ...config,
  137. ...userConfig,
  138. };
  139. };