import { EggAppInfo } from 'egg' ; import { ConnectionOptions } from 'typeorm' ; import { DefaultConfig } from './config.types' ; /**
 * 关于环境变量的配置，请查阅文档：https://www.yuque.com/midwayjs/midway_v2/eggjs#0JHun
 */ export default ( appInfo ) : DefaultConfig => { const config = { } as DefaultConfig ; config . keys = appInfo . name + '_1602294995416_4568' ; config . middleware = [ 'jwtAuth' ] ; config . midwayFeature = { replaceEggLogger : true , } ; config . admin = { username : 'admin' , password : 'admin' , } ; config . orm = { type : 'mysql' , host : process . env . MYSQL_HOST || '127.0.0.1' , port : process . env . MYSQL_PORT || 3306 , username : process . env . MYSQL_USER || '' , password : process . env . MYSQL_PASSWORD || '' , database : process . env . MYSQL_DATABASE || undefined , synchronize : false , logging : true , timezone : '+08:00' , } as ConnectionOptions ; config . redis = { client : { port : + process . env . REDIS_PORT || 6379 , host : process . env . REDIS_HOST || '127.0.0.1' , password : process . env . REDIS_PASSWORD || '' , db : + process . env . REDIS_DB || 0 , } , } ; config . swagger = { title : 'service-mw2' , description : 'service-mw2 模版工程的接口定义' , version : '1.1.0' , termsOfService : 'https://github.com/fsd-nodejs/service-mw2' , contact : { name : 'tkvern' , url : 'https://github.com/tkvern' , email : 'verncake@gmail.com' , } , license : { name : 'MIT' , url : 'https://github.com/midwayjs/midway/blob/serverless/LICENSE' , } , } ; const epoch = 1577836800000 ; config . koid = { dataCenter : 0 , worker : 0 , epoch , } ; config . rabbitmq = { url : process . env . RABBITMQ_URL || 'amqp://localhost' , } ; return config ; } ;