config.default.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. isDevData: true,
  39. };
  40. const fixGroupAgg = require('../app/util/fixGroupAgg');
  41. config.mongoose = {
  42. // url: 'mongodb://账号:密码@服务器:端口/库名',
  43. url: process.env.EGG_MONGODB_URL || 'mongodb://127.0.0.1/faw-etl-local',
  44. options: {
  45. server: {
  46. poolSize: 40,
  47. },
  48. },
  49. clients: {
  50. etlDB: { // 原始数据库
  51. url: 'mongodb://127.0.0.1/faw-etl', //
  52. // url: 'mongodb://faw-etl-readonly:faw-etl-readonly@10.6.222.37:27017/faw-etl',//dev
  53. // url: 'mongodb://faw-etl-admin:faw-etl-admin%40123@10.112.16.11:27017/faw-etl', // sit
  54. // url: 'mongodb://faw-etl:faw-etl123@uat.dbaas.private:27028/faw-etl', // uat
  55. options: {
  56. useUnifiedTopology: true,
  57. poolSize: 40,
  58. },
  59. },
  60. etlLocalDB: { // 本地清洗后的数据库
  61. url: 'mongodb://127.0.0.1/faw-etl-local', //
  62. // url: 'mongodb://faw-etl-local:faw-etl-local%40123@10.6.222.37:27017/faw-etl-local', // dev
  63. // url: 'mongodb://faw-etl-local:faw-etl-local%40123@10.112.16.11:27017/faw-etl-local', // sit
  64. // url: 'mongodb://local3:local3%40123@uat.dbaas.private:27028/faw-etl-local3', // uat
  65. options: {
  66. useUnifiedTopology: true,
  67. poolSize: 40,
  68. },
  69. },
  70. },
  71. plugins: [ fixGroupAgg ],
  72. };
  73. config.validate = { // 配置参数校验器,基于parameter
  74. convert: true, // 对参数可以使用convertType规则进行类型转换
  75. // validateRoot: false, // 限制被验证值必须是一个对象。
  76. };
  77. config.redis = {
  78. };
  79. return {
  80. ...config,
  81. ...userConfig,
  82. };
  83. };