Debug Proxy Pass
This commit is contained in:
parent
73baddb820
commit
dc5a369e55
12
.vscode/launch.json
vendored
12
.vscode/launch.json
vendored
@ -13,12 +13,12 @@
|
|||||||
"args": [
|
"args": [
|
||||||
"s",
|
"s",
|
||||||
"X",
|
"X",
|
||||||
"D:/5-Other-Small/Kanban-messa010ec/Kanban/Work-Items",
|
"L:/Git/Linux-Ubuntu-Server/etc/nginx/include",
|
||||||
"Day-Helper-2024-09-11",
|
"Day-Helper-2024-09-16",
|
||||||
"*.json",
|
"*.conf",
|
||||||
".kanbn",
|
"L:/Git/Linux-Ubuntu-Server/etc/nginx/sites-available/default",
|
||||||
"Epic|Feature|User Story",
|
"include /etc/nginx/include/",
|
||||||
"L:/DevOps/Mesa_FI/File-Folder-Helper/.vscode/helper/tfs",
|
"proxy_pass",
|
||||||
"666",
|
"666",
|
||||||
"777",
|
"777",
|
||||||
"888",
|
"888",
|
||||||
|
@ -107,6 +107,8 @@ internal static class HelperDay
|
|||||||
Day.Q32024.Helper20240910.MoveFilesToWeekOfYear(logger, args);
|
Day.Q32024.Helper20240910.MoveFilesToWeekOfYear(logger, args);
|
||||||
else if (args[1] == "Day-Helper-2024-09-11")
|
else if (args[1] == "Day-Helper-2024-09-11")
|
||||||
Day.Q32024.Helper20240911.WriteMarkdown(logger, args);
|
Day.Q32024.Helper20240911.WriteMarkdown(logger, args);
|
||||||
|
else if (args[1] == "Day-Helper-2024-09-16")
|
||||||
|
Day.Q32024.Helper20240916.DebugProxyPass(logger, args);
|
||||||
else
|
else
|
||||||
throw new Exception(appSettings.Company);
|
throw new Exception(appSettings.Company);
|
||||||
}
|
}
|
||||||
|
58
Day/Q32024/Helper-2024-09-16.cs
Normal file
58
Day/Q32024/Helper-2024-09-16.cs
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
namespace File_Folder_Helper.Day.Q32024;
|
||||||
|
|
||||||
|
internal static partial class Helper20240916
|
||||||
|
{
|
||||||
|
|
||||||
|
private static ReadOnlyCollection<string> Get(string searchPattern, string[] configFileLines)
|
||||||
|
{
|
||||||
|
List<string> results = [];
|
||||||
|
string[] segments;
|
||||||
|
foreach (string line in configFileLines)
|
||||||
|
{
|
||||||
|
if (line.Length < 2 || line[0] == '#')
|
||||||
|
continue;
|
||||||
|
segments = line.Split(searchPattern);
|
||||||
|
if (segments.Length < 2)
|
||||||
|
continue;
|
||||||
|
results.Add(segments[1].Split(';')[0]);
|
||||||
|
}
|
||||||
|
return results.AsReadOnly();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void DebugProxyPass(ILogger<Worker> logger, List<string> args)
|
||||||
|
{
|
||||||
|
string debug;
|
||||||
|
string enable;
|
||||||
|
string[] lines;
|
||||||
|
string fileName;
|
||||||
|
string[] segments;
|
||||||
|
string configFile = args[3];
|
||||||
|
string searchPattern = args[2];
|
||||||
|
string searchPatternB = args[4];
|
||||||
|
string searchPatternC = args[5];
|
||||||
|
string sourceDirectory = Path.GetFullPath(args[0]);
|
||||||
|
string[] configFileLines = File.ReadAllLines(configFile);
|
||||||
|
ReadOnlyCollection<string> enabledSites = Get(searchPatternB, configFileLines);
|
||||||
|
logger.LogInformation("Found {files} file(s)", enabledSites.Count);
|
||||||
|
string[] files = Directory.GetFiles(sourceDirectory, searchPattern, SearchOption.AllDirectories);
|
||||||
|
logger.LogInformation("With search pattern '{SearchPattern}' found {files} file(s)", searchPattern, files.Length);
|
||||||
|
foreach (string file in files)
|
||||||
|
{
|
||||||
|
debug = string.Empty;
|
||||||
|
lines = File.ReadAllLines(file);
|
||||||
|
fileName = Path.GetFileName(file);
|
||||||
|
foreach (string line in lines)
|
||||||
|
{
|
||||||
|
segments = line.Split(searchPatternC);
|
||||||
|
if (segments.Length < 2)
|
||||||
|
continue;
|
||||||
|
debug = segments[1].Trim();
|
||||||
|
}
|
||||||
|
enable = enabledSites.Contains(fileName) ? string.Empty : "# ";
|
||||||
|
logger.LogInformation("{enable}{searchPatternB}{fileName}; # https://{fileName}.phares.duckddns.org # {debug}", enable, searchPatternB, fileName, fileName, debug);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user