configuration structure update

This commit is contained in:
Adam R Grey 2023-03-23 16:49:18 -04:00
parent 56a4bcbcb5
commit 36c8805ce9
3 changed files with 17 additions and 9 deletions

View File

@ -8,9 +8,7 @@ namespace newsletter
public class Reporter
{
public string ReporterClass { get; set; }
public string Url { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public IEnumerable<KeyValuePair<string, string>> Misc { get; set; }
}
}
}

View File

@ -1,4 +1,5 @@
using HtmlAgilityPack;
using System.Text;
using System.Threading.Tasks;
namespace newsletter.Reporters
@ -8,9 +9,16 @@ namespace newsletter.Reporters
#pragma warning disable CS1998
public override async Task<Report> Report(Configuration.Reporter config)
{
var sb = new StringBuilder();
sb.AppendLine("dummy node for testing purposes.");
if(config.Misc?.Any() == true)
foreach (var miscConfig in config.Misc)
{
sb.AppendLine($"{miscConfig.Key}: {miscConfig.Value}");
}
return new Report()
{
ReportContent = HtmlNode.CreateNode($"<div>dummy node for testing purposes. Url: {config.Url}, Username: {config.Username}, Password: {config.Password}.</div>"),
ReportContent = HtmlNode.CreateNode($"<div>{sb.ToString()}</div>"),
TextSummary = "dummy text for testing purposes"
};
}

View File

@ -1,11 +1,13 @@
{
"exportPath": "./newsletter.html",
"exportPath": "../newsletter.html",
"reporters": [
{
"type":"dummy",
"url": "localhost:8080",
"username": "guy who didn't configure",
"password": "sordph1sh"
"reporterClass":"dummy",
"misc":[
{"key": "url", "value": "localhost:8080"},
{"key": "username", "value": "guy who didn't configure"},
{"key": "password", "value": "sordph1sh"}
]
}
]
}