Update aree configurate
- ConnString x aree mongodb/redis in dotNetFramework - nuova sezione ServerConf
This commit is contained in:
@@ -147,7 +147,7 @@ namespace WebConfigSetter
|
||||
configFilesJson = Directory.GetFiles(baseWebAppDir, "appsettings.json", SearchOption.AllDirectories);
|
||||
}
|
||||
|
||||
// STEP 1: processo files XML (stile asp.net <= 4.8)
|
||||
// STEP 1: processo files XML (stile asp.net <= 4.8)
|
||||
XmlDocument doc = new XmlDocument();
|
||||
foreach (var item in configFilesXml)
|
||||
{
|
||||
@@ -161,7 +161,19 @@ namespace WebConfigSetter
|
||||
|
||||
for (int i = 0; i < appSettingsList.Count; i++)
|
||||
{
|
||||
bool doSave = false;
|
||||
// stringhe conn a DB principali
|
||||
if (appSettingsList[i].Attributes["key"].Value.Contains("ConnectionString"))
|
||||
{
|
||||
doSave = true;
|
||||
}
|
||||
// stringhe conn al DB secondari (MongoDB...)
|
||||
if (appSettingsList[i].Attributes["key"].Value.Contains("ConnString"))
|
||||
{
|
||||
doSave = true;
|
||||
}
|
||||
// se trovato --> salvo
|
||||
if (doSave)
|
||||
{
|
||||
if (!currConfig.appSettRules.ContainsKey(appSettingsList[i].Attributes["key"].Value))
|
||||
{
|
||||
@@ -186,7 +198,6 @@ namespace WebConfigSetter
|
||||
foreach (var item in configFilesJson)
|
||||
{
|
||||
Console.WriteLine($"JSON Found: {item}");
|
||||
|
||||
string currFileData = File.ReadAllText(item);
|
||||
if (!string.IsNullOrEmpty(currFileData))
|
||||
{
|
||||
@@ -198,6 +209,7 @@ namespace WebConfigSetter
|
||||
{
|
||||
Console.WriteLine($"Eccezione in decodifica item {item}{Environment.NewLine}{exc}");
|
||||
}
|
||||
// processo le stringhe di connessione
|
||||
if (currJsonConf.ConnectionStrings != null)
|
||||
{
|
||||
foreach (var chiave in currJsonConf.ConnectionStrings)
|
||||
@@ -208,6 +220,17 @@ namespace WebConfigSetter
|
||||
}
|
||||
}
|
||||
}
|
||||
// processo area ServerConf degli altri parametri da sistemare
|
||||
if (currJsonConf.ServerConf != null)
|
||||
{
|
||||
foreach (var chiave in currJsonConf.ServerConf)
|
||||
{
|
||||
if (!currConfig.jsonConnStrRules.ContainsKey(chiave.Key))
|
||||
{
|
||||
currConfig.jsonConnStrRules.Add(chiave.Key, chiave.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,7 +257,7 @@ namespace WebConfigSetter
|
||||
string[] configFilesJson = Directory.GetFiles(baseWebAppDir, "appsettings*.json", SearchOption.AllDirectories);
|
||||
XmlDocument doc = new XmlDocument();
|
||||
|
||||
// STEP 1: processo files XML (stile asp.net <= 4.8)
|
||||
// STEP 1: processo files XML (stile asp.net <= 4.8)
|
||||
foreach (var item in configFiles)
|
||||
{
|
||||
Console.Write($"XML Found: {item} --> ");
|
||||
|
||||
Reference in New Issue
Block a user