{ "Sers": { /* 消息队列配置 */ "Mq": { "Config": { /* 后台处理消息的线程个数(单位个,默认2) */ "workThreadCount": 2, /* 请求超时时间(单位ms,默认60000) */ "requestTimeoutMs": 60000, //HeartBeat /* 心跳测试超时时间(单位ms,默认2000) */ "heartBeatTimeoutMs": 10000, /* 心跳测试失败重试次数(单位次,默认3) */ "heartBeatRetryCount": 10, /* 心跳测试时间间隔(单位ms,默认1000) */ "heartBeatIntervalMs": 2000 }, /* one mq is one channel.can be multiable */ "ClientMqBuilder": [ { /* (x.1) mq type - Iocp */ /* the class of MqBuilder in assemblyFile */ "className": "Sers.Mq.Socket.Iocp.MqBuilder.ClientMqBuilder", /* (x.2) mq config */ /* Mq 服务端 host地址。例如: "127.0.0.1"、"sersms.com" */ "host": "127.0.0.1", /* Mq 服务端 监听端口号。例如: 10345 */ "port": 10345, /* Mq连接秘钥,用以验证连接安全性。服务端和客户端必须一致 */ "secretKey": "SersSocketMq" } ] }, "Logger": { /* print the log to console. default:false */ "PrintToConsole": true }, /* ServiceStation配置,可不指定 */ "ServiceStation": { /* serviceStation站点信息 */ "serviceStationInfo": { "serviceStationName": "Gateway" } }, "Api": { //调用api前的事件,可不指定 "BeforeCallApi": [ { //Bearer 在调用接口前,会获取 rpcData.http.headers.Authorization(格式为 "Bearer xxxxxx"),并作为参数调用接口api_verifyAt,把返回数据放到 rpcData.user.userInfo //"className": "Bearer", /* 验证at接口的地址 */ "api_verifyAt": "/AuthCenter/account/verifyAt" }, { //AccountInCookie 在调用接口前,会获取 rpcData.http.headers.Cookie(格式为 "user=xxx;c=7")中的user,在账号列表中比对userToken,回写 CallerSource(rpcData.caller.source) 和 userInfo(rpcData.user.userInfo) //"className": "AccountInCookie", "account": [ { "userToken": "admin_123456", //"CallerSource": "Internal", "userInfo": { "name": "超级管理员", "入口": "Gover网关" } } ] } ] }, /* 网关配置 */ "Gateway": { /* Rpc 配置*/ "Rpc": { /* 网关转发的请求中的rpc 信息中的 CallerSource。(暗指调用来源,默认"OutSide") */ "CallerSource": "OutSide" }, "WebHost": { /* url,可多个 */ "urls": [ "http://*:6000" ], /* http回应中的默认Content-Type。若不指定则默认为 "application/json; charset="+Serialization.Instance.charset */ "//ResponseDefaultContentType": "application/json; charset=UTF-8", /* 静态文件的路径,若为空字符串则默认为当前目录下的wwwroot文件夹,若不指定(null)则不映射静态文件 */ "//wwwroot": "" }, /* 服务限流 配置 */ "rateLimit": [ { /* 服务限流key,标识一个限流服务,必须唯一 */ "rateLimitKey": "rate", /* 固定时间窗口限流。在单位时间(msInterval)内限制最大请求数量为reqLimit。超出数量的请求将被拒绝 */ "rateLimitType": "FixedWindow", /* 单位时间内最大请求数量(个)*/ "reqLimit": 100000, /* 单位时间长度(单位:ms)*/ "msInterval": 1000 } ] } } }