From f068a79c1a39f7f796e045628693241b0f3bc15a Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Mon, 21 Sep 2020 10:53:15 +0200 Subject: #988 Add global config variable This commit makes configuration variable global. To use this variable you have to #import "cfg.h". --- src/cfg.h | 2 ++ src/main.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/cfg.h b/src/cfg.h index 6c7d221..c88a406 100644 --- a/src/cfg.h +++ b/src/cfg.h @@ -23,4 +23,6 @@ struct og_server_cfg { int parse_json_config(const char *filename, struct og_server_cfg *cfg); void from_json_to_legacy(struct og_server_cfg *cfg); +extern struct og_server_cfg cfg; + #endif diff --git a/src/main.c b/src/main.c index 48f0c00..1f23296 100644 --- a/src/main.c +++ b/src/main.c @@ -20,10 +20,11 @@ #define OG_SERVER_CFG_JSON "/opt/opengnsys/cfg/ogserver.json" +struct og_server_cfg cfg; + int main(int argc, char *argv[]) { struct ev_io ev_io_server_rest, ev_io_agent_rest; - struct og_server_cfg cfg = {}; og_loop = ev_default_loop(0); -- cgit v1.2.3-18-g5258