From 96090fdec1db6e350bc9e0db0c632f495b33f595 Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Fri, 26 Jun 2020 19:59:27 +0200 Subject: [PATCH] #988 use ogserver.json fallback to legacy configuration file Check for ogserver.json file first, then fall back to legacy. --- sources/main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sources/main.c b/sources/main.c index 3588e4c..5f6d164 100644 --- a/sources/main.c +++ b/sources/main.c @@ -18,7 +18,7 @@ #include "cfg.h" #include -#define OG_SERVER_CFG_DATABASE "/opt/opengnsys/cfg/ogserver.json" +#define OG_SERVER_CFG_JSON "/opt/opengnsys/cfg/ogserver.json" int main(int argc, char *argv[]) { @@ -36,11 +36,12 @@ int main(int argc, char *argv[]) if (!validacionParametros(argc, argv, 1)) // Valida parámetros de ejecución exit(EXIT_FAILURE); - if (!tomaConfiguracion(szPathFileCfg)) { - syslog(LOG_INFO, "falling back to %s\n", OG_SERVER_CFG_DATABASE); - if (parse_json_config(OG_SERVER_CFG_DATABASE, &cfg) < 0) + if (parse_json_config(OG_SERVER_CFG_JSON, &cfg) < 0) { + syslog(LOG_INFO, "Falling back to legacy configuration file at %s\n", + szPathFileCfg); + if (!tomaConfiguracion(szPathFileCfg)) exit(EXIT_FAILURE); - + } else { from_json_to_legacy(&cfg); }