appsettings.json 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. {
  2. "Logging": {
  3. "LogLevel": {
  4. "Default": "Warning"
  5. }
  6. },
  7. "Sers": {
  8. /* 通讯层配置 */
  9. "CL": {
  10. /* 共用配置,子项共用,覆写子项未指定的配置 */
  11. "Config": {
  12. /* 请求超时时间(单位ms,默认60000) */
  13. "requestTimeoutMs": 60000,
  14. /* 后台处理消息的线程个数(单位个,默认2) */
  15. "workThreadCount": 8,
  16. //HeartBeat
  17. /* 心跳检测时间间隔(单位ms,默认10000,若指定为0则不进行心跳检测) */
  18. "heartBeatIntervalMs": 10000,
  19. /* 心跳检测超时时间(单位ms,默认30000) */
  20. "heartBeatTimeoutMs": 30000,
  21. /* 心跳检测失败重试次数(单位次,默认10) */
  22. "heartBeatRetryCount": 10,
  23. /* 连接秘钥,用以验证连接安全性。服务端和客户端必须一致 */
  24. "secretKey": "SersCL"
  25. },
  26. /* one conn is one channel.can be multiable */
  27. "Server": [
  28. {
  29. // Socket.Iocp
  30. /* (x.1) type - Iocp */
  31. /* the class of Builder in assemblyFile */
  32. "className": "Sers.CL.Socket.Iocp.OrganizeServerBuilder",
  33. /* (x.2) conn config */
  34. /* 服务端 监听地址。若不指定则监听所有网卡。例如: "127.0.0.1"、"sersms.com"。*/
  35. //"host": "127.0.0.1",
  36. /* 服务端 监听端口号。例如: 4501 */
  37. "port": 4501
  38. },
  39. {
  40. // Socket.ThreadWait
  41. /* (x.1) type - Socket */
  42. /* the class of Builder in assemblyFile */
  43. //"className": "Sers.CL.Socket.ThreadWait.OrganizeServerBuilder",
  44. /* (x.2) config */
  45. /* 服务端 监听地址。若不指定则监听所有网卡。例如: "127.0.0.1"、"sersms.com"。*/
  46. //"host": "127.0.0.1",
  47. /* 服务端 监听端口号。例如: 4501 */
  48. "port": 4501
  49. },
  50. {
  51. // Zmq.ThreadWait
  52. /* (x.1) type */
  53. /* 在此Assembly中查找Builder */
  54. "assemblyFile": "Sers.CL.ClrZmq.ThreadWait.dll",
  55. /* the class of Builder in assemblyFile */
  56. //"className": "Sers.CL.ClrZmq.ThreadWait.OrganizeServerBuilder",
  57. /* (x.2) config */
  58. /* 地址。例如: "tcp://*:4502" 、 "ipc://4502" */
  59. "endpoint": "tcp://*:4502"
  60. },
  61. {
  62. // WebSocket
  63. /* (x.1) type - Iocp */
  64. /* 在此Assembly中查找builder */
  65. "assemblyFile": "Sers.CL.WebSocket.dll",
  66. /* the class of builder in assemblyFile */
  67. "className": "Sers.CL.WebSocket.OrganizeServerBuilder",
  68. /* (x.2) conn config */
  69. /* 服务端地址(默认为 "ws://0.0.0.0:4503") */
  70. "host": "ws://0.0.0.0:4503"
  71. },
  72. {
  73. // Zmq.FullDuplex
  74. /* (x.1) type */
  75. /* 在此Assembly中查找Builder */
  76. "assemblyFile": "Sers.CL.Zmq.FullDuplex.dll",
  77. /* the class of Builder in assemblyFile */
  78. //"className": "Sers.CL.Zmq.FullDuplex.OrganizeServerBuilder",
  79. /* (x.2) config */
  80. /* 地址。例如: "tcp://*:4504" 、 "ipc://4504" */
  81. "endpoint": "tcp://*:4504"
  82. },
  83. {
  84. //Ipc.SharedMemory
  85. /* (x.1) type - Ipc.SharedMemory */
  86. /* 在此Assembly中查找Builder */
  87. "assemblyFile": "Sers.CL.Ipc.SharedMemory.dll",
  88. /* the class of Builder in assemblyFile */
  89. //"className": "Sers.CL.Ipc.SharedMemory.OrganizeServerBuilder",
  90. /* (x.2) config */
  91. /* 共享内存名称。例如: "ipcTest" */
  92. "name": "ipcForStationDemo",
  93. /* 共享内存节点个数。例如: 64 */
  94. "nodeCount": 128,
  95. /* 共享内存节点大小。例如: 2048 */
  96. "nodeBufferSize": 102400
  97. },
  98. {
  99. /* (x.1) type - Ipc.SharedMemory */
  100. /* 在此Assembly中查找Builder */
  101. "assemblyFile": "Sers.CL.Ipc.SharedMemory.dll",
  102. /* the class of Builder in assemblyFile */
  103. //"className": "Sers.CL.Ipc.SharedMemory.OrganizeServerBuilder",
  104. /* (x.2)config */
  105. /* 共享内存名称。例如: "ipcTest" */
  106. "name": "ipcForRobot",
  107. /* 共享内存节点个数。例如: 64 */
  108. "nodeCount": 128,
  109. /* 共享内存节点大小。例如: 2048 */
  110. "nodeBufferSize": 102400
  111. }
  112. ]
  113. },
  114. /* LocalApiService 配置,可不指定 */
  115. "LocalApiService": {
  116. /* 后台服务的线程个数(单位个,默认0,代表不开启服务)*/
  117. "workThreadCount": 1,
  118. /* 是否 输出本地Api的调用信息到(ApiTrace)Log文件。默认:false */
  119. "PrintTrace": false,
  120. /* 默认站点名称,可多个,可不指定 */
  121. //"apiStationNames": [ "StationDemo" ],
  122. /* Api加载器配置 */
  123. "//ApiLoaders": [
  124. {
  125. /* 加载器的类名,可为 Sers.ApiLoader.Ss.ApiLoader 、 Sers.ApiLoader.WebApi21.ApiLoader 等。若不指定则默认为"Sers.ApiLoader.Ss.ApiLoader" */
  126. "loader_className": "Sers.ApiLoader.WebApi21.ApiLoader",
  127. /* 在此Assembly中查找服务(如 Sers.Core.Station.dll 、Sers.ApiLoader.WebApi21.dll) */
  128. "loader_assemblyFile": "Sers.ApiLoader.WebApi21.dll",
  129. //(通过反射从此包中获取要加载的api)
  130. /* 在此Assembly中查找服务(如 App.StationDemo.Station.dll)(assembly、assemblyFile、assemblyName 指定任一即可) */
  131. "assemblyFile": "App.StationDemo.Station.dll",
  132. /* 在此Assembly中查找服务(如 App.StationDemo.Station)(assembly、assemblyFile、assemblyName 指定任一即可) */
  133. //"assemblyName": "App.StationDemo.Station",
  134. /* 强制指定ApiStation名称。可不指定。(优先级从高到低: apiStationName_Force 、 在代码上的SsStationNameAttribute特性指定 、 apiStationName 、 appsettings.json指定) */
  135. //"apiStationName_Force": "",
  136. /* ApiStation名称。可不指定。(优先级从高到低: apiStationName_Force 、 在代码上的SsStationNameAttribute特性指定 、 apiStationName 、 appsettings.json指定) */
  137. "apiStationName": "StationDemo"
  138. /* 强制路由前缀,例如:"demo/v1"。可不指定。(优先级从高到低: routePrefix_Force、在代码上的SsRoutePrefixAttribute特性指定 、 routePrefix) */
  139. //"routePrefix_Force": "",
  140. /* 路由前缀,例如:"demo/v1"。可不指定。(优先级从高到低: routePrefix_Force、在代码上的SsRoutePrefixAttribute特性指定 、 routePrefix ) */
  141. //"routePrefix": ""
  142. }
  143. ],
  144. //调用api前的事件,可不指定
  145. "//BeforeCallApi": [
  146. {
  147. //Bearer 在调用接口前,会获取 rpcData.http.headers.Authorization(格式为 "Bearer xxxxxx"),并作为参数调用接口api_verifyAt,把返回数据放到 rpcData.user.userInfo
  148. "className": "Bearer",
  149. /* 验证at接口的地址 */
  150. "api_verifyAt": "/AuthCenter/account/verifyAt"
  151. },
  152. {
  153. //AccountInCookie 在调用接口前,会获取 rpcData.http.headers.Cookie(格式为 "user=xxx;c=7")中的user,在账号列表中比对userToken,回写 CallerSource(rpcData.caller.source) 和 userInfo(rpcData.user.userInfo)
  154. "className": "AccountInCookie",
  155. "account": [
  156. {
  157. "userToken": "admin_123456",
  158. //"CallerSource": "Internal",
  159. "userInfo": {
  160. "name": "超级管理员",
  161. "入口": "Gover网关"
  162. }
  163. }
  164. ]
  165. }
  166. ]
  167. },
  168. /* ServiceStation配置,可不指定 */
  169. "ServiceStation": {
  170. /* 自动上报cpu Usage。不指定则不上报 */
  171. "//UsageReporter": {
  172. /* 上报时间间隔(单位:秒) */
  173. "intervalSecond": 2
  174. },
  175. /* serviceStation站点信息 */
  176. "serviceStationInfo": {
  177. /* 服务站点名称 */
  178. "serviceStationName": "ServiceCenter",
  179. /* 服务站点版本信息,若不指定则为入口链接库的版本号 */
  180. //"stationVersion": "2.1.1",
  181. /* [json]服务站点额外信息,可不指定 */
  182. "info": null
  183. }
  184. },
  185. /* ServiceCenter 配置,可不指定 */
  186. "ServiceCenter": {
  187. /* 是否 输出Api注册事件到(Info)Log文件。默认:true */
  188. "ApiRegistEvent_Print": true,
  189. /* api路由管理方式,可不指定。可为:"RESTful","IgnoreHttpMethod"。若不指定或未指定有效值,则默认为"RESTful" */
  190. //"ApiRouteType": "IgnoreHttpMethod",
  191. //调用api前的事件,可不指定
  192. "BeforeCallApi": [
  193. {
  194. //Bearer 在调用接口前,会获取 rpcData.http.headers.Authorization(格式为 "Bearer xxxxxx"),并作为参数调用接口api_verifyAt,把返回数据放到 rpcData.user.userInfo
  195. //"className": "Bearer",
  196. /* 验证at接口的地址 */
  197. "api_verifyAt": "/AuthCenter/account/verifyAt",
  198. /* 验证at接口的httpMethod。(如 GET POST 可不指定) */
  199. "api_httpMethod": "POST"
  200. },
  201. {
  202. //AccountInCookie 在调用接口前,会获取 rpcData.http.headers.Cookie(格式为 "user=xxx;c=7")中的user,在账号列表中比对userToken,回写 CallerSource(rpcData.caller.source) 和 userInfo(rpcData.user.userInfo)
  203. //"className": "AccountInCookie",
  204. "account": [
  205. {
  206. "userToken": "admin_123456",
  207. //"CallerSource": "Internal",
  208. "userInfo": {
  209. "name": "超级管理员",
  210. "入口": "Gover网关"
  211. }
  212. }
  213. ]
  214. }
  215. ]
  216. },
  217. /* 网关配置(同目录下可以指定mappings.json文件) ,可不指定 */
  218. "Gateway": {
  219. /* Rpc配置,可不指定 */
  220. "Rpc": {
  221. /* 网关转发的请求中的rpc 信息中的 CallerSource。(暗指调用来源,默认"OutSide") */
  222. //"CallerSource": "OutSide"
  223. },
  224. "WebHost": {
  225. /* url,可多个 */
  226. "urls": [ "http://*:4580" ],
  227. /* http回应中的默认Content-Type。若不指定则默认为 "application/json; charset="+Serialization.Instance.charset */
  228. "//ResponseDefaultContentType": "application/json; charset=UTF-8",
  229. /* 静态文件路径。可为相对路径或绝对路径。若为空字符串则默认为当前目录下的wwwroot文件夹。若不指定(null)则不映射静态文件。 */
  230. "wwwroot": ""
  231. },
  232. //调用api前的事件,可不指定
  233. "BeforeCallApi": [
  234. {
  235. //Bearer 在调用接口前,会获取 rpcData.http.headers.Authorization(格式为 "Bearer xxxxxx"),并作为参数调用接口api_verifyAt,把返回数据放到 rpcData.user.userInfo
  236. //"className": "Bearer",
  237. /* 验证at接口的地址 */
  238. "api_verifyAt": "/AuthCenter/account/verifyAt",
  239. /* 验证at接口的httpMethod。(如 GET POST 可不指定) */
  240. "api_httpMethod": "POST"
  241. },
  242. {
  243. //AccountInCookie 在调用接口前,会获取 rpcData.http.headers.Cookie(格式为 "user=xxx;c=7")中的user,在账号列表中比对userToken,回写 CallerSource(rpcData.caller.source) 和 userInfo(rpcData.user.userInfo)
  244. "className": "AccountInCookie",
  245. "account": [
  246. {
  247. "userToken": "admin_123456",
  248. "CallerSource": "Internal",
  249. "userInfo": {
  250. "name": "Gover管理员",
  251. "入口": "Gover网关"
  252. }
  253. }
  254. ]
  255. }
  256. ],
  257. /* 服务限流配置,可不指定 */
  258. "rateLimit": [
  259. {
  260. /* 服务限流key,标识一个限流服务,必须唯一 */
  261. "rateLimitKey": "rate",
  262. /* 固定时间窗口限流。在单位时间(msInterval)内限制最大请求数量为reqLimit。超出数量的请求将被拒绝 */
  263. "rateLimitType": "FixedWindow",
  264. /* 单位时间内最大请求数量(个)*/
  265. "reqLimit": 100000,
  266. /* 单位时间长度(单位:ms)*/
  267. "msInterval": 1000
  268. }
  269. ]
  270. }
  271. },
  272. /* Vit工具配置,可不指定 */
  273. "Vit": {
  274. /* 日志配置,可不指定 */
  275. "Logger": {
  276. /* print the log to console. default:false */
  277. "PrintToConsole": true
  278. },
  279. /* 序列化配置,可不指定 */
  280. "Serialization": {
  281. /* 序列化字符编码。可不指定,默认 UTF8。只可为 UTF7,UTF8,UTF32,ASCII,Unicode。 */
  282. "Encoding": "UTF8",
  283. /* 时间序列化格式。可不指定,默认 "yyyy-MM-dd HH:mm:ss" */
  284. "DateTimeFormat": "yyyy-MM-dd HH:mm:ss"
  285. },
  286. "Kestrel": {
  287. /* the maximum allowed size of any request body in bytes. When set to null, the maximum request body size is unlimited. */
  288. "//MaxRequestBodySize": 100000000
  289. }
  290. }
  291. }