From 11ed8c9e1dfe9139387ec55f1a22b6ced6838348 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sun, 28 Jul 2024 23:32:22 -0400 Subject: [PATCH] Reduce code duplication when initializing Refresh.HttpsProxy --- Refresh.HttpsProxy/Program.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Refresh.HttpsProxy/Program.cs b/Refresh.HttpsProxy/Program.cs index 9d581a04..0faaa3c8 100644 --- a/Refresh.HttpsProxy/Program.cs +++ b/Refresh.HttpsProxy/Program.cs @@ -23,17 +23,14 @@ // Initialize a Bunkum server for HTTP BunkumServer httpServer = new BunkumHttpServer(loggerConfiguration); -ProxyConfig config = Config.LoadFromJsonFile("proxy.json", httpsServer.Logger); - -httpsServer.Initialize = s => +Action initialize = s => { + ProxyConfig config = Config.LoadFromJsonFile("proxy.json", s.Logger); s.AddMiddleware(new ProxyMiddleware(config)); }; -httpServer.Initialize = s => -{ - s.AddMiddleware(new ProxyMiddleware(config)); -}; +httpsServer.Initialize = initialize; +httpServer.Initialize = initialize; // Start the server in multi-threaded mode, and let Bunkum manage the rest. httpsServer.Start();