Skip to content

Commit

Permalink
Reduce code duplication when initializing Refresh.HttpsProxy
Browse files Browse the repository at this point in the history
  • Loading branch information
jvyden committed Jul 29, 2024
1 parent 7d0a88a commit 11ed8c9
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions Refresh.HttpsProxy/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,14 @@
// Initialize a Bunkum server for HTTP
BunkumServer httpServer = new BunkumHttpServer(loggerConfiguration);

ProxyConfig config = Config.LoadFromJsonFile<ProxyConfig>("proxy.json", httpsServer.Logger);

httpsServer.Initialize = s =>
Action<BunkumServer> initialize = s =>
{
ProxyConfig config = Config.LoadFromJsonFile<ProxyConfig>("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();
Expand Down

0 comments on commit 11ed8c9

Please sign in to comment.