Uat_Study
hang 2023-04-06 11:17:42 +08:00
parent 8f745481f0
commit dc10030a67
2 changed files with 43 additions and 66 deletions

View File

@ -1,16 +1,13 @@
{
"ConnectionStrings": {
"hang": "Server=ZHOU;Database=IRaCIS;User ID=sa;Password=sa123456;"
},
"JwtSetting": {
"SecurityKey": "3e6dbfa227234a03977a2f421bdb7f4f", //
"Issuer": "IRaCIS", //
"Audience": "ZhiZhun", //
"TokenExpireDays": "7" // 7day
"SecurityKey": "3e6dbfa227234a03977a2f421bdb7f4f",
"Issuer": "IRaCIS",
"Audience": "ZhiZhun",
"TokenExpireDays": "7"
},
"IpRateLimiting": {
"EnableEndpointRateLimiting": true, //False: globally executed, true: executed for each
"StackBlockedRequests": false, // set to false, rejected calls are not added to the throttle counter
"EnableEndpointRateLimiting": true,
"StackBlockedRequests": false,
"RealIpHeader": "X-Real-IP",
"ClientIdHeader": "X-ClientId",
"QuotaExceededResponse": {
@ -19,12 +16,10 @@
"StatusCode": 429
},
"HttpStatusCode": 429,
//"IpWhitelist": [ "127.0.0.1", "::1/10", "192.168.0.0/24" ],
"EndpointWhitelist": [ "post:/study/archivestudy/*" ],
//"EndpointWhitelist": [ ],
//"EndpointWhitelist": ["post:/trial/getTrialList"], //demo
"EndpointWhitelist": [
"post:/study/archivestudy/*"
],
"IpWhitelist": [],
//"ClientWhitelist": [ "dev-id-1", "dev-id-2" ],
"GeneralRules": [
{
"Endpoint": "*",
@ -48,7 +43,6 @@
}
]
},
"easycaching": {
"inmemory": {
"MaxRdSecond": 120,
@ -63,30 +57,19 @@
}
}
},
"UpdateConfig": {
"test": "123456",
"test1": "12345678"
},
"IRaCISBasicConfig": {
"DoctorCodePrefix": "RE",
"UserCodePrefix": "U",
"QCChallengeCodePrefix": "Q",
"NoneDicomStudyCodePrefix": "NST",
"DicomStudyCodePrefix": "ST",
"SystemSiteCodePrefix": "S",
"DefaultPassword": "123456",
"DefaultInternalOrganizationName": "ExtImaging",
"ImageShareExpireDays": 10
}
//访 dicom ... ip
}

View File

@ -109,9 +109,7 @@ namespace IRaCIS.Core.Application.Service.Common
//jObject.WriteTo(jsonTextWriter);
#endregion
#region test
//var json = File.ReadAllText("appsettings.json");
//var jObject = JToken.Parse(json, new JsonLoadSettings { CommentHandling = CommentHandling.Load,DuplicatePropertyNameHandling=DuplicatePropertyNameHandling.Ignore });
@ -149,7 +147,7 @@ namespace IRaCIS.Core.Application.Service.Common
//File.WriteAllText("appsettings.json", updatedJson);
// string json = @"{
//string json = @"{
// // This is a comment
// ""Name"": ""John Smith"",
// ""Age"": 30,
@ -162,21 +160,19 @@ namespace IRaCIS.Core.Application.Service.Common
// }
//}";
// // 使用 Json.NET 库解析 JSON 字符串
// JObject jObject = JObject.Parse(json,new JsonLoadSettings() { CommentHandling=CommentHandling.Load});
//// 使用 Json.NET 库解析 JSON 字符串
//JObject jObject = JObject.Parse(json, new JsonLoadSettings() { CommentHandling = CommentHandling.Load });
// // 修改属性
// jObject["Name"] = "Jane Smith";
// // 将修改后的 JObject 对象序列化为 JSON 字符串并保留注释
// string newJson = jObject.ToString(Formatting.Indented);
// // 打印修改后的 JSON 字符串
// Console.WriteLine(newJson);
//// 修改属性
//jObject["Name"] = "Jane Smith";
//// 将修改后的 JObject 对象序列化为 JSON 字符串并保留注释
//string newJson = jObject.ToString(Newtonsoft.Json.Formatting.Indented);
//// 打印修改后的 JSON 字符串
//Console.WriteLine(newJson);
#endregion
// 读取 Json 文件
@ -184,40 +180,38 @@ namespace IRaCIS.Core.Application.Service.Common
var json = File.ReadAllText("appsettings.json");
JObject jsonObject = JObject.Parse(json, new JsonLoadSettings() { CommentHandling=CommentHandling.Load});
JObject jsonObject = JObject.Parse(json, new JsonLoadSettings() { CommentHandling = CommentHandling.Load });
// 获取 UpdateConfig 属性所在的节点
JToken updateConfigNode = jsonObject.SelectToken("UpdateConfig");
JProperty updateConfigProperty = (JProperty)updateConfigNode.Parent;
JObject updateConfigParent = (JObject)updateConfigProperty.Value;
// 向 updateConfigParent 添加或者属性
updateConfigParent[key] = newValue;
// 将更改保存回 Json 文件
//File.WriteAllText(jsonFilePath, jsonObject.ToString());
File.WriteAllText(jsonFilePath, jsonObject.ToString());
using (var reader = new JsonTextReader(new StringReader(json)))
using (var writer = new JsonTextWriter(new StreamWriter("appsettings.json")))
{
while (reader.Read())
{
if (reader.TokenType == JsonToken.PropertyName && (string)reader.Value == key)
{
// Write the updated property value
writer.WritePropertyName(key);
writer.WriteValue(newValue);
continue;
}
//using (var reader = new JsonTextReader(new StringReader(json)))
//using (var writer = new JsonTextWriter(new StreamWriter("appsettings.json")))
//{
// while (reader.Read())
// {
// if (reader.TokenType == JsonToken.PropertyName && (string)reader.Value == key)
// {
// // Write the updated property value
// writer.WritePropertyName(key);
// writer.WriteValue(newValue);
// reader.Read();
// continue;
// }
// Write all other tokens
writer.WriteToken(reader.TokenType, reader.Value);
}
}
// // Write all other tokens
// writer.WriteToken(reader.TokenType, reader.Value);
// }
//}