config.default.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 + '_1576464120622_7058';
  14. // post form请求 关闭csrf安全插件
  15. config.security = {
  16. csrf: {
  17. enable: false,
  18. ignoreJSON: true,
  19. },
  20. // domainWhiteList: [ 'http://www.baidu.com' ], // 配置白名单
  21. };
  22. config.cluster = {
  23. listen: {
  24. port: 7001,
  25. },
  26. };
  27. // add your middleware config here
  28. config.middleware = [ 'errorHandler' ];
  29. // add your user config here
  30. const userConfig = {
  31. // myAppName: 'egg',
  32. cors: {
  33. origin: '*', // 注释掉就是上面的white生效
  34. allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH',
  35. },
  36. GDKEY: '61fa7b06efe476b14bfd7cda375d90ff',
  37. GDAPI: 'https://restapi.amap.com/v3/geocode/regeo',
  38. };
  39. const fixGroupAgg = require('../app/util/fixGroupAgg');
  40. config.mongoose = {
  41. // url: 'mongodb://账号:密码@服务器:端口/库名',
  42. url: process.env.EGG_MONGODB_URL || 'mongodb://127.0.0.1/faw-etl-local',
  43. options: {
  44. server: {
  45. poolSize: 40,
  46. },
  47. },
  48. clients: {
  49. etlDB: { // 原始数据库
  50. url: 'mongodb://127.0.0.1/faw-etl', //
  51. // url: 'mongodb://faw-etl-readonly:faw-etl-readonly@10.6.222.37:27017/faw-etl',//dev
  52. // url: 'mongodb://faw-etl-admin:faw-etl-admin%40123@10.112.16.11:27017/faw-etl', // sit
  53. // url: 'mongodb://faw-etl:faw-etl123@uat.dbaas.private:27028/faw-etl', // uat
  54. options: {
  55. useUnifiedTopology: true,
  56. poolSize: 40,
  57. },
  58. },
  59. etlLocalDB: { // 本地清洗后的数据库
  60. url: 'mongodb://127.0.0.1/faw-etl-local', //
  61. // url: 'mongodb://faw-etl-local:faw-etl-local%40123@10.6.222.37:27017/faw-etl-local', // dev
  62. // url: 'mongodb://faw-etl-local:faw-etl-local%40123@10.112.16.11:27017/faw-etl-local', // sit
  63. // url: 'mongodb://local3:local3%40123@uat.dbaas.private:27028/faw-etl-local3', // uat
  64. options: {
  65. useUnifiedTopology: true,
  66. poolSize: 40,
  67. },
  68. },
  69. },
  70. plugins: [ fixGroupAgg ],
  71. };
  72. config.validate = { // 配置参数校验器,基于parameter
  73. convert: true, // 对参数可以使用convertType规则进行类型转换
  74. // validateRoot: false, // 限制被验证值必须是一个对象。
  75. };
  76. config.redis = {
  77. };
  78. return {
  79. ...config,
  80. ...userConfig,
  81. };
  82. };