Read config file for fallback when no command line arguments are given.

This commit is contained in:
Martin Preuss
2023-10-03 16:51:15 +02:00
parent 0740378ad8
commit 831c94f898
24 changed files with 324 additions and 34 deletions

View File

@@ -15,6 +15,7 @@
#include "./aqhomed_p.h"
#include "./tty_log.h"
#include "aqhome/aqhome.h"
#include "aqhome/msg/endpoint_tty.h"
#include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/ipc/endpoint_ipcclient.h"
@@ -87,6 +88,7 @@ int AqHomed_Init(AQHOMED *aqh, int argc, char **argv)
DBG_ERROR(NULL, "Error reading args (%d)", rv);
return rv;
}
AQH_MergeConfigFileIntoConfig(dbArgs, "ConfigFile");
aqh->dbArgs=dbArgs;
s=GWEN_DB_GetCharValue(dbArgs, "pidfile", 0, AQHOMED_DEFAULT_PIDFILE);
@@ -150,7 +152,12 @@ void _setupIpcd(AQHOMED *aqh, GWEN_DB_NODE *dbArgs)
int tcpPort;
tcpAddress=GWEN_DB_GetCharValue(dbArgs, "tcpAddress", 0, NULL);
tcpPort=GWEN_DB_GetIntValue(dbArgs, "tcpPort", 0, AQHOMED_DEFAULT_IPC_PORT);
if (!(tcpAddress && *tcpAddress))
tcpAddress=GWEN_DB_GetCharValue(dbArgs, "ConfigFile/nodesAddress", 0, NULL);
tcpPort=GWEN_DB_GetIntValue(dbArgs, "tcpPort", 0, -1);
if (tcpPort<0)
tcpPort=GWEN_DB_GetIntValue(dbArgs, "ConfigFile/nodesPort", 0, AQHOMED_DEFAULT_IPC_PORT);
if (tcpAddress && *tcpAddress && tcpPort) {
GWEN_MSG_ENDPOINT *ep;