修改json 配置
parent
3a4e33570e
commit
2814c56e0f
|
@ -23,6 +23,36 @@ namespace IRaCIS.Core.API
|
|||
public readonly string environment;
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
|
||||
#region 数据库连接写入配置文件
|
||||
|
||||
var currentDicectory = AppContext.BaseDirectory;
|
||||
|
||||
var rootPath = (Directory.GetParent(currentDicectory.TrimEnd('\\'))).FullName;
|
||||
var configPath = Path.Combine(rootPath, "resources/config.json");
|
||||
|
||||
var initConfigJson = File.ReadAllText(configPath);
|
||||
|
||||
var innitJsonObj = JObject.Parse(initConfigJson);
|
||||
|
||||
var dbServerName = innitJsonObj["dbServerName"].ToString();
|
||||
var dbLoginUser = innitJsonObj["dbLoginUser"].ToString();
|
||||
var dbPwd = innitJsonObj["dbPwd"].ToString();
|
||||
|
||||
|
||||
var appsettingsJson = File.ReadAllText("appsettings.CertificateApply.json");
|
||||
|
||||
// 解析 JSON 字符串
|
||||
var jObject = JObject.Parse(appsettingsJson);
|
||||
|
||||
// 获取 UpdateConfig 属性所在的节点
|
||||
var updateConfigNode = jObject["ConnectionStrings"];
|
||||
|
||||
|
||||
updateConfigNode["RemoteNew"] = $"Server={dbServerName};Database=IRaCIS;User ID={dbLoginUser};Password={dbPwd}11;TrustServerCertificate=true";
|
||||
|
||||
#endregion
|
||||
|
||||
try
|
||||
{
|
||||
//以配置文件为准,否则 从url中取环境值(服务以命令行传递参数启动,配置文件配置了就不需要传递环境参数)
|
||||
|
@ -114,13 +144,7 @@ namespace IRaCIS.Core.API
|
|||
|
||||
#endregion
|
||||
|
||||
#region 数据库连接写入配置文件
|
||||
|
||||
var appsettingsJson = File.ReadAllText("appsettings.CertificateApply.json");
|
||||
|
||||
//var
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue