diff options
author | Roberto Hueso Gómez <rhueso@soleta.eu> | 2020-06-25 10:46:46 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2020-06-26 14:55:23 +0200 |
commit | 866b6c5e3766f65719f730ac4dac11b221a6692a (patch) | |
tree | 156e77509f6edaf2178e31e01987f367cc6d9c7f /sources/main.c | |
parent | c0f5d2c2068968822c2d1d397bf84447ae2e5642 (diff) |
#988 add json configuration file
New configuration file at /opt/opengnsys/cfg/ogserver.json
Diffstat (limited to 'sources/main.c')
-rw-r--r-- | sources/main.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sources/main.c b/sources/main.c index d0add72..3588e4c 100644 --- a/sources/main.c +++ b/sources/main.c @@ -15,11 +15,15 @@ #include "json.h" #include "schedule.h" #include "core.h" +#include "cfg.h" #include <syslog.h> +#define OG_SERVER_CFG_DATABASE "/opt/opengnsys/cfg/ogserver.json" + int main(int argc, char *argv[]) { struct ev_io ev_io_server_rest, ev_io_agent_rest; + struct og_server_cfg cfg = {}; int i; og_loop = ev_default_loop(0); @@ -32,8 +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)) { // Toma parametros de configuracion - 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) + exit(EXIT_FAILURE); + + from_json_to_legacy(&cfg); } for (i = 0; i < MAXIMOS_CLIENTES; i++) { |