aboutsummaryrefslogtreecommitdiff
path: root/lib/Emails.Transactional.Plugin/src/TEmailEntryPoint.cs
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2023-01-12 17:47:40 -0500
committerLibravatar vnugent <public@vaughnnugent.com>2023-01-12 17:47:40 -0500
commitd797953c74798252d7153a20e788ed034c71b0ae (patch)
treebb295b619a4c0ed13d18691063ddaebd3961faf5 /lib/Emails.Transactional.Plugin/src/TEmailEntryPoint.cs
parentd8ef5d21416c4a9deaa5cae7d3c8a11fae6a15f7 (diff)
Large project reorder and consolidation
Diffstat (limited to 'lib/Emails.Transactional.Plugin/src/TEmailEntryPoint.cs')
-rw-r--r--lib/Emails.Transactional.Plugin/src/TEmailEntryPoint.cs88
1 files changed, 88 insertions, 0 deletions
diff --git a/lib/Emails.Transactional.Plugin/src/TEmailEntryPoint.cs b/lib/Emails.Transactional.Plugin/src/TEmailEntryPoint.cs
new file mode 100644
index 0000000..c95ca08
--- /dev/null
+++ b/lib/Emails.Transactional.Plugin/src/TEmailEntryPoint.cs
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2022 Vaughn Nugent
+*
+* Library: VNLib
+* Package: Transactional Emails
+* File: TEmailEntryPoint.cs
+*
+* TEmailEntryPoint.cs is part of Transactional Emails which is part of the larger
+* VNLib collection of libraries and utilities.
+*
+* Transactional Emails is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published
+* by the Free Software Foundation, either version 2 of the License,
+* or (at your option) any later version.
+*
+* Transactional Emails is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with Transactional Emails. If not, see http://www.gnu.org/licenses/.
+*/
+
+using System;
+using System.Threading.Tasks;
+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();
+ }
+ }
+}