diff --git a/.includeControls b/.includeControls index f0e984b..58e8ba5 100644 --- a/.includeControls +++ b/.includeControls @@ -1,4 +1,12 @@ -lstWrapper/publish +lstWrapper/publish/wwwroot +lstWrapper/publish/appsettings-example.json +lstWrapper/publish/LstWrapper.deps.json +lstWrapper/publish/LstWrapper.dll +lstWrapper/publish/LstWrapper.exe +lstWrapper/publish/LstWrapper.pdb +lstWrapper/publish/LstWrapper.runtimeconfig.json +lstWrapper/publish/LstWrapper.staticwebassets.endpoints.json +web.config controller/lst_ctl.exe controller/.env-example scripts/update-controller-bumpBuild.ps1 diff --git a/lstWrapper/Program.cs b/lstWrapper/Program.cs index 50f31f1..701153c 100644 --- a/lstWrapper/Program.cs +++ b/lstWrapper/Program.cs @@ -9,12 +9,15 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.HttpOverrides; using Microsoft.Extensions.DependencyInjection; + var builder = WebApplication.CreateBuilder(args); // Register HttpClient so we can proxy HTTP traffic builder.Services.AddHttpClient(); var app = builder.Build(); +var port8080 = builder.Configuration.GetValue("ProxyConfig:Port8080", 8080); +var port4000 = builder.Configuration.GetValue("ProxyConfig:Port4000", 4000); // Enable WebSocket support app.UseWebSockets(); @@ -74,14 +77,14 @@ app.Run(async (HttpContext context) => if (rawPath.StartsWith("/socket.io", StringComparison.OrdinalIgnoreCase) || rawPath.StartsWith("/lst/socket.io", StringComparison.OrdinalIgnoreCase)) { - backendHttpBase = "http://localhost:8080"; - backendWsBase = "ws://localhost:8080"; + backendHttpBase = $"http://localhost:{port8080}"; + backendWsBase = $"ws://localhost:{port8080}"; } else if (rawPath.StartsWith("/lst/api/controller", StringComparison.OrdinalIgnoreCase) || rawPath.StartsWith("/api/controller", StringComparison.OrdinalIgnoreCase)) { - backendHttpBase = "http://localhost:8080"; - backendWsBase = "ws://localhost:8080"; + backendHttpBase = $"http://localhost:{port8080}"; + backendWsBase = $"ws://localhost:{port8080}"; // Now strip only once // var newPath = rawPath.Substring("/lst".Length); @@ -89,8 +92,8 @@ app.Run(async (HttpContext context) => } else { - backendHttpBase = "http://localhost:4000"; - backendWsBase = "ws://localhost:4000"; + backendHttpBase = $"http://localhost:{port4000}"; + backendWsBase = $"ws://localhost:{port4000}"; } // Handle WebSocket requests diff --git a/lstWrapper/appsettings-example.json b/lstWrapper/appsettings-example.json new file mode 100644 index 0000000..c5aef04 --- /dev/null +++ b/lstWrapper/appsettings-example.json @@ -0,0 +1,13 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "ProxyConfig": { + "Port8080": 8080, + "Port4000": 4000 + } +} diff --git a/lstWrapper/appsettings.json b/lstWrapper/appsettings.json index 10f68b8..c5aef04 100644 --- a/lstWrapper/appsettings.json +++ b/lstWrapper/appsettings.json @@ -1,9 +1,13 @@ { - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "ProxyConfig": { + "Port8080": 8080, + "Port4000": 4000 } - }, - "AllowedHosts": "*" }