mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-07-02 02:28:19 +00:00
feat: Allow WebAPI to load if no config file is present
This commit is contained in:
parent
89c23f5432
commit
c52d585a0c
2 changed files with 18 additions and 7 deletions
|
|
@ -20,6 +20,8 @@ namespace PepperDash.Essentials.Core.Web
|
|||
private readonly WebApiServer _debugServer;
|
||||
|
||||
|
||||
|
||||
|
||||
///<example>
|
||||
/// http(s)://{ipaddress}/cws/{basePath}
|
||||
/// http(s)://{ipaddress}/VirtualControl/Rooms/{roomId}/cws/{basePath}
|
||||
|
|
@ -301,7 +303,11 @@ namespace PepperDash.Essentials.Core.Web
|
|||
{
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "{routeName:l}: {routePath:l}/{routeUrl:l}", route.Name, path, route.Url);
|
||||
}
|
||||
Debug.LogInformation(this, "Web API initialized and ready to accept requests");
|
||||
|
||||
Debug.LogMessage(LogEventLevel.Information, this, new string('-', 50));
|
||||
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "Developer Tools Web App available at: https://{currentIp}/cws/debug", currentIp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -274,10 +274,9 @@ namespace PepperDash.Essentials
|
|||
PluginLoader.LoadPlugins();
|
||||
|
||||
Debug.LogMessage(LogEventLevel.Information, "Folder structure verified. Loading config...");
|
||||
if (!ConfigReader.LoadConfig2())
|
||||
if (!ConfigReader.LoadConfig2() || ConfigReader.ConfigObject == null)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Information, "Essentials Load complete with errors");
|
||||
return;
|
||||
Debug.LogMessage(LogEventLevel.Warning, "Unable to load config file. Please ensure a valid config file is present and restart the program.");
|
||||
}
|
||||
|
||||
Load();
|
||||
|
|
@ -399,6 +398,12 @@ namespace PepperDash.Essentials
|
|||
new Core.Monitoring.SystemMonitorController("systemMonitor"));
|
||||
}
|
||||
|
||||
if (ConfigReader.ConfigObject is null)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Warning, "LoadDevices: ConfigObject is null. Cannot load devices.");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var devConf in ConfigReader.ConfigObject.Devices)
|
||||
{
|
||||
IKeyed newDev = null;
|
||||
|
|
@ -452,7 +457,7 @@ namespace PepperDash.Essentials
|
|||
|
||||
var tlc = TieLineCollection.Default;
|
||||
|
||||
if (ConfigReader.ConfigObject.TieLines == null)
|
||||
if (ConfigReader.ConfigObject?.TieLines == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -749,7 +754,7 @@ namespace PepperDash.Essentials
|
|||
/// </summary>
|
||||
public void LoadRooms()
|
||||
{
|
||||
if (ConfigReader.ConfigObject.Rooms == null)
|
||||
if (ConfigReader.ConfigObject?.Rooms == null)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Information, "Notice: Configuration contains no rooms - Is this intentional? This may be a valid configuration.");
|
||||
return;
|
||||
|
|
@ -786,13 +791,13 @@ namespace PepperDash.Essentials
|
|||
/// </summary>
|
||||
void LoadLogoServer()
|
||||
{
|
||||
if (ConfigReader.ConfigObject.Rooms == null)
|
||||
if (ConfigReader.ConfigObject?.Rooms == null)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Information, "No rooms configured. Bypassing Logo server startup.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
if (ConfigReader.ConfigObject?.Rooms == null ||
|
||||
!ConfigReader.ConfigObject.Rooms.Any(
|
||||
CheckRoomConfig))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue