#988 use ogserver.json fallback to legacy configuration file

Check for ogserver.json file first, then fall back to legacy.
master
OpenGnSys Support Team 2020-06-26 19:59:27 +02:00
parent 866b6c5e37
commit 96090fdec1
1 changed files with 6 additions and 5 deletions

View File

@ -18,7 +18,7 @@
#include "cfg.h"
#include <syslog.h>
#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);
}