appsettings.json 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. {
  2. "Sers": {
  3. /* 消息队列配置 */
  4. "Mq": {
  5. "Config": {
  6. /* 后台处理消息的线程个数(单位个,默认2) */
  7. "workThreadCount": 2,
  8. /* 请求超时时间(单位ms,默认60000) */
  9. "requestTimeoutMs": 60000,
  10. //HeartBeat
  11. /* 心跳测试超时时间(单位ms,默认2000) */
  12. "heartBeatTimeoutMs": 10000,
  13. /* 心跳测试失败重试次数(单位次,默认3) */
  14. "heartBeatRetryCount": 10,
  15. /* 心跳测试时间间隔(单位ms,默认1000) */
  16. "heartBeatIntervalMs": 2000
  17. },
  18. /* one mq is one channel.can be multiable */
  19. "ClientMqBuilder": [
  20. {
  21. /* (x.1) mq type - Iocp */
  22. /* the class of MqBuilder in assemblyFile */
  23. "className": "Sers.Mq.Socket.Iocp.MqBuilder.ClientMqBuilder",
  24. /* (x.2) mq config */
  25. /* Mq 服务端 host地址。例如: "127.0.0.1"、"sersms.com" */
  26. "host": "127.0.0.1",
  27. /* Mq 服务端 监听端口号。例如: 10345 */
  28. "port": 10345,
  29. /* Mq连接秘钥,用以验证连接安全性。服务端和客户端必须一致 */
  30. "secretKey": "SersSocketMq"
  31. }
  32. ]
  33. },
  34. "Logger": {
  35. /* print the log to console. default:false */
  36. "PrintToConsole": true
  37. },
  38. /* ServiceStation配置,可不指定 */
  39. "ServiceStation": {
  40. /* serviceStation站点信息 */
  41. "serviceStationInfo": {
  42. "serviceStationName": "Gateway"
  43. }
  44. },
  45. "Api": {
  46. //调用api前的事件,可不指定
  47. "BeforeCallApi": [
  48. {
  49. //Bearer 在调用接口前,会获取 rpcData.http.headers.Authorization(格式为 "Bearer xxxxxx"),并作为参数调用接口api_verifyAt,把返回数据放到 rpcData.user.userInfo
  50. //"className": "Bearer",
  51. /* 验证at接口的地址 */
  52. "api_verifyAt": "/AuthCenter/account/verifyAt"
  53. },
  54. {
  55. //AccountInCookie 在调用接口前,会获取 rpcData.http.headers.Cookie(格式为 "user=xxx;c=7")中的user,在账号列表中比对userToken,回写 CallerSource(rpcData.caller.source) 和 userInfo(rpcData.user.userInfo)
  56. //"className": "AccountInCookie",
  57. "account": [
  58. {
  59. "userToken": "admin_123456",
  60. //"CallerSource": "Internal",
  61. "userInfo": {
  62. "name": "超级管理员",
  63. "入口": "Gover网关"
  64. }
  65. }
  66. ]
  67. }
  68. ]
  69. },
  70. /* 网关配置 */
  71. "Gateway": {
  72. /* Rpc 配置*/
  73. "Rpc": {
  74. /* 网关转发的请求中的rpc 信息中的 CallerSource。(暗指调用来源,默认"OutSide") */
  75. "CallerSource": "OutSide"
  76. },
  77. "WebHost": {
  78. /* url,可多个 */
  79. "urls": [ "http://*:6000" ],
  80. /* http回应中的默认Content-Type。若不指定则默认为 "application/json; charset="+Serialization.Instance.charset */
  81. "//ResponseDefaultContentType": "application/json; charset=UTF-8",
  82. /* 静态文件的路径,若为空字符串则默认为当前目录下的wwwroot文件夹,若不指定(null)则不映射静态文件 */
  83. "//wwwroot": ""
  84. },
  85. /* 服务限流 配置 */
  86. "rateLimit": [
  87. {
  88. /* 服务限流key,标识一个限流服务,必须唯一 */
  89. "rateLimitKey": "rate",
  90. /* 固定时间窗口限流。在单位时间(msInterval)内限制最大请求数量为reqLimit。超出数量的请求将被拒绝 */
  91. "rateLimitType": "FixedWindow",
  92. /* 单位时间内最大请求数量(个)*/
  93. "reqLimit": 100000,
  94. /* 单位时间长度(单位:ms)*/
  95. "msInterval": 1000
  96. }
  97. ]
  98. }
  99. }
  100. }