aboutsummaryrefslogtreecommitdiff
path: root/Transactional Emails/TEmailEntryPoint.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Transactional Emails/TEmailEntryPoint.cs')
-rw-r--r--Transactional Emails/TEmailEntryPoint.cs63
1 files changed, 63 insertions, 0 deletions
diff --git a/Transactional Emails/TEmailEntryPoint.cs b/Transactional Emails/TEmailEntryPoint.cs
new file mode 100644
index 0000000..97b9c86
--- /dev/null
+++ b/Transactional Emails/TEmailEntryPoint.cs
@@ -0,0 +1,63 @@
+using System;
+using System.Collections.Generic;
+
+using Emails.Transactional.Endpoints;
+
+using Minio;
+using Minio.DataModel.Tracing;
+
+using VNLib.Utils.Logging;
+using VNLib.Plugins;
+using VNLib.Plugins.Extensions.Loading.Routing;
+
+namespace Emails.Transactional
+{
+ public class TEmailEntryPoint : PluginBase
+ {
+ public override string PluginName => "Emails.Transactional";
+
+ internal class ReqLogger : IRequestLogger
+ {
+ private readonly ILogProvider logProvider;
+
+ public ReqLogger(ILogProvider log)
+ {
+ logProvider = log;
+ }
+
+ public void LogRequest(RequestToLog requestToLog, ResponseToLog responseToLog, double durationMs)
+ {
+ logProvider.Debug("S3 result\n{method} {uri} HTTP {ms}ms\nHTTP {status} {message}\n{content}",
+ requestToLog.method, requestToLog.resource, durationMs,
+ responseToLog.statusCode, responseToLog.errorMessage, responseToLog.content
+ );
+ }
+ }
+
+ protected override void OnLoad()
+ {
+ try
+ {
+ //Route send oauth endpoint
+ this.Route<SendEndpoint>();
+
+ Log.Information("Plugin loaded");
+ }
+ catch (KeyNotFoundException kne)
+ {
+ Log.Warn("Missing required configuration keys {err}", kne.Message);
+ }
+ }
+
+
+ protected override void OnUnLoad()
+ {
+ Log.Information("Plugin unloaded");
+ }
+
+ protected override void ProcessHostCommand(string cmd)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}