mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-07-02 02:28:19 +00:00
fix: improve error logging for routing devices and ports; ensure API server initializes correctly
This commit is contained in:
parent
a45b26fadc
commit
3137796335
3 changed files with 18 additions and 6 deletions
|
|
@ -69,14 +69,14 @@ namespace PepperDash.Essentials.Core.Config
|
|||
// Get the source device
|
||||
if (!(DeviceManager.GetDeviceForKey(SourceKey) is IRoutingOutputs sourceDev))
|
||||
{
|
||||
LogError("Routable source not found");
|
||||
LogError($"Routable source not found for key '{SourceKey}'");
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get the destination device
|
||||
if (!(DeviceManager.GetDeviceForKey(DestinationKey) is IRoutingInputs destDev))
|
||||
{
|
||||
LogError("Routable destination not found");
|
||||
LogError($"Routable destination not found for key '{DestinationKey}'");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ namespace PepperDash.Essentials.Core.Config
|
|||
|
||||
if (sourceOutputPort == null)
|
||||
{
|
||||
LogError("Source does not contain port");
|
||||
LogError($"Source '{SourceKey}' does not contain port '{SourcePort}'");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ namespace PepperDash.Essentials.Core.Config
|
|||
|
||||
if (destinationInputPort == null)
|
||||
{
|
||||
LogError("Destination does not contain port");
|
||||
LogError($"Destination '{DestinationKey}' does not contain port '{DestinationPort}'");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace PepperDash.Essentials.Core.Web
|
|||
|
||||
private readonly WebApiServer _debugServer;
|
||||
|
||||
|
||||
private bool isInitialized;
|
||||
|
||||
|
||||
///<example>
|
||||
|
|
@ -230,6 +230,11 @@ namespace PepperDash.Essentials.Core.Web
|
|||
/// <inheritdoc />
|
||||
public override void Initialize()
|
||||
{
|
||||
if (isInitialized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AddRoute(new HttpCwsRoute("apiPaths")
|
||||
{
|
||||
Name = "GetPaths",
|
||||
|
|
@ -264,6 +269,8 @@ namespace PepperDash.Essentials.Core.Web
|
|||
_debugServer.Start();
|
||||
|
||||
GetPaths();
|
||||
|
||||
isInitialized = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -140,7 +140,9 @@ namespace PepperDash.Essentials
|
|||
CrestronConsole.AddNewConsoleCommand(DeviceManager.GetRoutingPorts,
|
||||
"getroutingports", "Reports all routing ports, if any. Requires a device key", ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
DeviceManager.AddDevice(new EssentialsWebApi("essentialsWebApi", "Essentials Web API"));
|
||||
|
||||
var apiServer = new EssentialsWebApi("essentialsWebApi", "Essentials Web API");
|
||||
DeviceManager.AddDevice(apiServer);
|
||||
|
||||
if (!Debug.DoNotLoadConfigOnNextBoot)
|
||||
{
|
||||
|
|
@ -148,6 +150,9 @@ namespace PepperDash.Essentials
|
|||
return;
|
||||
}
|
||||
|
||||
// Init the API server even if we're not loading config to allow for dynamic loading via console command
|
||||
apiServer.Initialize();
|
||||
|
||||
if (!(bool)preventInitialization)
|
||||
{
|
||||
SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue