appsettings.json 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. {
  2. /* asp.net core 原始web服务配置 */
  3. "server": {
  4. "urls": [ "http://localhost:4513" ]
  5. },
  6. "Logging": {
  7. "LogLevel": {
  8. "Default": "Warning"
  9. }
  10. },
  11. "AllowedHosts": "*",
  12. "Sers": {
  13. /* 通讯层配置 */
  14. "CL": {
  15. /* one conn is one channel.can be multiable */
  16. "Client": [
  17. {
  18. // Socket.Iocp
  19. /* (x.1) type - Iocp */
  20. /* the class of builder in assemblyFile */
  21. "className": "Sers.CL.Socket.Iocp.OrganizeClientBuilder",
  22. /* (x.2) conn config */
  23. /* 服务端 host地址。例如: "127.0.0.1"、"sersms.com" */
  24. "host": "127.0.0.1",
  25. /* 服务端 监听端口号。例如: 4501 */
  26. "port": 4501,
  27. /* 连接秘钥,用以验证连接安全性。服务端和客户端必须一致 */
  28. "secretKey": "SersCL"
  29. }
  30. ]
  31. },
  32. /* LocalApiService 配置,可不指定 */
  33. "LocalApiService": {
  34. /* 后台服务的线程个数(单位个,默认0,代表不开启服务) */
  35. "workThreadCount": 4,
  36. /* 超时时间,若不指定则后台任务永不超时。(主动关闭超过此时间的任务,实际任务强制关闭的时间会在1倍超时时间到2倍超时时间内)。单位:ms。*/
  37. //"timeout_ms": 10000,
  38. /* 是否 输出本地Api的调用信息到(ApiTrace)Log文件。默认:false */
  39. "PrintTrace": false,
  40. /* 静态文件映射器。映射站点静态文件,可多个,可不指定 */
  41. "//StaticFileMap": [
  42. {
  43. /* api路由前缀,例如 "/demo/ui/*" */
  44. "route": "/demo/ui/*",
  45. /* api描述,静态文件描述 */
  46. "apiName": "demo站点静态文件",
  47. /* 静态文件路径。可为相对路径或绝对路径。若未指定存在的文件夹则默认为当前目录下的wwwroot文件夹。demo:"wwwroot/demo" */
  48. "staticFileDirectory": "wwwroot/demo",
  49. /* 额外静态文件类型映射配置的文件路径(mappings.json),例如"wwwroot/mappings.json"。若不指定(或指定的文件不存在)则不添加额外文件类型映射配置 */
  50. "ContentTypeMapFile": "mappings.json"
  51. }
  52. ],
  53. /* 默认站点名称,可多个,可不指定 */
  54. //"apiStationNames": [ "demo" ],
  55. /* Api加载器配置 */
  56. "//ApiLoaders": [
  57. {
  58. /* 在此Assembly中查找api加载器(如 Sers.Core.dll 、Sers.NetcoreLoader.dll 、 Sers.Serslot.dll ) */
  59. //"loader_assemblyFile": "Sers.Core.dll",
  60. /* 加载器的类名,可为 Sers.SersLoader.ApiLoader 、 Sers.NetcoreLoader.ApiLoader、 Sers.Serslot.ApiLoader 等。若不指定则默认为"Sers.SersLoader.ApiLoader" */
  61. //"loader_className": "Sers.SersLoader.ApiLoader",
  62. //(通过反射从此包中获取要加载的api)
  63. /* 在此Assembly中查找服务(如 Did.SersLoader.Demo.dll)(assembly、assemblyFile、assemblyName 指定任一即可) */
  64. "assemblyFile": "Did.SersLoader.Demo.dll",
  65. /* 在此Assembly中查找服务(如 Did.SersLoader.Demo)(assembly、assemblyFile、assemblyName 指定任一即可) */
  66. //"assemblyName": "Did.SersLoader.Demo",
  67. /* 强制指定ApiStation名称。可不指定。(优先级从高到低: apiStationName_Force 、 在代码上的SsStationNameAttribute特性指定 、 apiStationName 、 appsettings.json指定) */
  68. //"apiStationName_Force": "",
  69. /* ApiStation名称。可不指定。(优先级从高到低: apiStationName_Force 、 在代码上的SsStationNameAttribute特性指定 、 apiStationName 、 appsettings.json指定) */
  70. "apiStationName": "demo"
  71. /* 强制路由前缀,例如:"demo/v1"。可不指定。(优先级从高到低: routePrefix_Force、在代码上的SsRoutePrefixAttribute特性指定 、 routePrefix) */
  72. //"routePrefix_Force": "",
  73. /* 路由前缀,例如:"demo/v1"。可不指定。(优先级从高到低: routePrefix_Force、在代码上的SsRoutePrefixAttribute特性指定 、 routePrefix ) */
  74. //"routePrefix": ""
  75. }
  76. ],
  77. //调用api前的事件,可不指定
  78. "//BeforeCallApi": [
  79. {
  80. //Bearer 在调用接口前,会获取 rpcData.http.headers.Authorization(格式为 "Bearer xxxxxx"),并作为参数调用接口api_verifyAt,把返回数据放到 rpcData.user.userInfo
  81. "className": "Bearer",
  82. /* 验证at接口的地址 */
  83. "api_verifyAt": "/AuthCenter/account/verifyAt",
  84. /* 验证at接口的httpMethod。(如 GET POST 可不指定) */
  85. "api_httpMethod": "POST"
  86. },
  87. {
  88. //AccountInCookie 在调用接口前,会获取 rpcData.http.headers.Cookie(格式为 "user=xxx;c=7")中的user,在账号列表中比对userToken,回写 CallerSource(rpcData.caller.source) 和 userInfo(rpcData.user.userInfo)
  89. "className": "AccountInCookie",
  90. "account": [
  91. {
  92. "userToken": "admin_123456",
  93. //"CallerSource": "Internal",
  94. "userInfo": {
  95. "name": "超级管理员",
  96. "入口": "Gover网关"
  97. }
  98. }
  99. ]
  100. }
  101. ]
  102. },
  103. /* ServiceStation配置,可不指定 */
  104. "ServiceStation": {
  105. /* 自动上报cpu Usage。不指定则不上报 */
  106. "//UsageReporter": {
  107. /* 上报时间间隔(单位:秒) */
  108. "intervalSecond": 2
  109. },
  110. /* 服务中心注册配置。在向服务中心注册站点前 是否打印(Logger.Info)请求参数。默认:false */
  111. "StationRegist_PrintRegistArg": false,
  112. /* serviceStation站点信息 */
  113. "serviceStationInfo": {
  114. "serviceStationName": "SerslotDemo",
  115. /* 服务站点版本信息,若不指定则为入口链接库的版本号 */
  116. //"stationVersion": "1.1.9.0",
  117. /* [json]服务站点额外信息,可不指定 */
  118. "info": null
  119. }
  120. }
  121. },
  122. /* Vit工具配置,可不指定 */
  123. "Vit": {
  124. /* 日志配置,可不指定 */
  125. "Logger": {
  126. /* print the log to console. default:false */
  127. "PrintToConsole": true
  128. },
  129. /* 序列化配置,可不指定 */
  130. "Serialization": {
  131. /* 序列化字符编码。可不指定,默认 UTF8。只可为 UTF7,UTF8,UTF32,ASCII,Unicode。 */
  132. "Encoding": "UTF8",
  133. /* 时间序列化格式。可不指定,默认 "yyyy-MM-dd HH:mm:ss" */
  134. "DateTimeFormat": "yyyy-MM-dd HH:mm:ss"
  135. }
  136. },
  137. "serslot": {
  138. /* 额外api。SsApiDesc格式。除了系统api外,可以指定额外api。若指定返回数据(reply),则直接返回数据;若不指定返回数据,则由host进行处理 */
  139. "//extApi": [
  140. { //为 SsApiDesc格式
  141. "description": "首页",
  142. //路由(可为泛接口,如 "/a/*" )
  143. "route": "/index.html",
  144. //扩展配置(json)
  145. "extendConfig": {
  146. //请求方式,若不指定则默认支持所有方式(demo: POST、GET、DELETE、PUT等)
  147. "httpMethod": "GET",
  148. //返回数据(可为数值、字符串、对象、数组)。若不指定,则由host进行处理
  149. "reply": { "hello": "sers" },
  150. //系统生成的接口文字描述
  151. "sysDesc": "method:GET"
  152. }
  153. },
  154. {
  155. //路由(可为泛接口,如 "/a/*" )
  156. "route": "/*"
  157. }
  158. ]
  159. }
  160. }