const path = require ( 'path' ) ; import { EggAppConfig , EggAppInfo , PowerPartial } from 'egg' ; const dotenv = require ( 'dotenv' ) ; dotenv . config ( { path : path . join ( __dirname , 'bombay.config' ) } ) ; declare const process ; const { MONGO_URI , REDIS_CLUSTER , ELASTICSEARCH_CLUSTER , HOST_API , MAP_API , MAP_KEY , KAFKA_CLUSTER , } = process . env ; export default ( appInfo ) => { const config = { } as PowerPartial < EggAppConfig > ; config . keys = appInfo . name + '_1566973855378_2564' ; config . kafkaSubmit = `${ HOST_API }/public-open/event/log/submit` ; config . mapApi = `${ MAP_API }/ws/location/v1/ip` ; config . mapKey = MAP_KEY ; config . middleware = [ 'graphql' , 'errorHandler' ] ; config . mongoose = { client : { url : MONGO_URI , options : { poolSize : 20 , } , } , } ; config . redis = { client : { cluster : true , nodes : [ { port : + REDIS_CLUSTER . split ( ':' ) [ 1 ] , host : REDIS_CLUSTER . split ( ':' ) [ 0 ] , password : '' , db : 0 , } ] , } , } ; config . security = { domainWhiteList : [ 'http://127.0.0.1:18090' ] , csrf : { enable : false , ignore : '/api/v1/report/**' , } , } ; config . cors = { origin : '*' , allowMethods : 'GET,PUT,POST,DELETE,OPTIONS' , } ; config . jwt = { secret : 'igola2019' , expiresIn : 60 * 60 * 12 , } ; config . bodyParser = { enableTypes : [ 'json' , 'form' , 'text' ] , } ; config . valparams = { locale : 'zh-cn' , throwError : false , } ; config . kafkaNode = { kafkaHost : `${ KAFKA_CLUSTER }` , clientOption : { } , } ; config . elasticsearch = { client : { host : ELASTICSEARCH_CLUSTER , apiVersion : '7.4' , } , } ; config . graphql = { router : '/graphql' , app : true , agent : false , graphiql : true , defaultEmptySchema : false , } ; const bizConfig = { sourceUrl : `https://github.com/eggjs/examples/tree/master/${ appInfo . name }` , origin : [ 'http://127.0.0.1:7002' , 'http://localhost:7002' , 'http://localhost:8000' , 'http://127.0.0.1:8000' , ] , user_pwd_salt_addition : 'BOMBAYJSUSERSALT' , user_login_timeout : 60 * 60 * 24 , redis_consumption : { task_time : '*/20 * * * * *' , thread_web : 100 , thread_wx : 100 , total_limit_web : 10000 , total_limit_wx : 10000 , } , report_filter : [ 'page' , 'county' , 'ip' , 'v' , 'ct' ] , } ; return { ... config , ... bizConfig , } ; } ;