mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-08-31 19:08:29 +00:00
refactor: Rename logging level switch variables for clarity and add fallback handler to WebApiServer to allow for serving debug app
This commit is contained in:
parent
c98b48ff87
commit
bfb9838743
4 changed files with 267 additions and 9 deletions
|
|
@ -18,6 +18,7 @@ namespace PepperDash.Essentials.Core.Web;
|
|||
public class EssentialsWebApi : EssentialsDevice
|
||||
{
|
||||
private readonly WebApiServer _server;
|
||||
private readonly WebApiServer _debugServer;
|
||||
|
||||
///<example>
|
||||
/// http(s)://{ipaddress}/cws/{basePath}
|
||||
|
|
@ -68,6 +69,9 @@ public class EssentialsWebApi : EssentialsDevice
|
|||
|
||||
_server = new WebApiServer(Key, Name, BasePath);
|
||||
|
||||
_debugServer = new WebApiServer($"{key}-debug-app", $"{name} Debug App", "/debug");
|
||||
_debugServer.SetFallbackHandler(new ServeDebugAppRequestHandler());
|
||||
|
||||
SetupRoutes();
|
||||
}
|
||||
|
||||
|
|
@ -226,6 +230,7 @@ public class EssentialsWebApi : EssentialsDevice
|
|||
Debug.LogMessage(LogEventLevel.Verbose, "Starting Essentials Web API on {0} Appliance", is4Series ? "4-series" : "3-series");
|
||||
|
||||
_server.Start();
|
||||
_debugServer.Start();
|
||||
|
||||
PrintPaths();
|
||||
|
||||
|
|
@ -236,6 +241,7 @@ public class EssentialsWebApi : EssentialsDevice
|
|||
Debug.LogMessage(LogEventLevel.Verbose, "Starting Essentials Web API on Virtual Control Server");
|
||||
|
||||
_server.Start();
|
||||
_debugServer.Start();
|
||||
|
||||
PrintPaths();
|
||||
}
|
||||
|
|
@ -277,6 +283,12 @@ public class EssentialsWebApi : EssentialsDevice
|
|||
{
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "{routeName:l}: {routePath:l}/{routeUrl:l}", route.Name, path, route.Url);
|
||||
}
|
||||
|
||||
var debugPath = CrestronEnvironment.DevicePlatform == eDevicePlatform.Server
|
||||
? $"https://{hostname}/VirtualControl/Rooms/{InitialParametersClass.RoomId}/cws/debug"
|
||||
: $"https://{currentIp}/cws/debug";
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "Debug App: {debugPath:l}", debugPath);
|
||||
|
||||
Debug.LogMessage(LogEventLevel.Information, this, new string('-', 50));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue