From: Jennifer Richards Date: Fri, 13 Apr 2018 16:43:25 +0000 (-0400) Subject: Parse monitoring port from internal configuration X-Git-Tag: 3.4.0~1^2~49^2~1 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=trust_router.git;a=commitdiff_plain;h=44c8ebb43831dbda399c34980c410565af60dcf2 Parse monitoring port from internal configuration --- diff --git a/common/tr_config_internal.c b/common/tr_config_internal.c index 85cd69c..82a57e2 100644 --- a/common/tr_config_internal.c +++ b/common/tr_config_internal.c @@ -146,7 +146,7 @@ do { \ */ TR_CFG_RC tr_cfg_parse_internal(TR_CFG *trc, json_t *jint) { - json_t *jlog = NULL; + json_t *jtmp = NULL; const char *s = NULL; if ((!trc) || (!jint)) @@ -175,20 +175,26 @@ TR_CFG_RC tr_cfg_parse_internal(TR_CFG *trc, json_t *jint) NOPARSE_UNLESS(tr_cfg_parse_unsigned(jint, "tid_response_numerator", &(trc->internal->tid_resp_numer))); NOPARSE_UNLESS(tr_cfg_parse_unsigned(jint, "tid_response_denominator", &(trc->internal->tid_resp_denom))); - if (NULL != (jlog = json_object_get(jint, "logging"))) { - NOPARSE_UNLESS(tr_cfg_parse_string(jlog, "log_threshold", &s)); + /* Parse the logging section */ + if (NULL != (jtmp = json_object_get(jint, "logging"))) { + NOPARSE_UNLESS(tr_cfg_parse_string(jtmp, "log_threshold", &s)); if (s) { trc->internal->log_threshold = str2sev(s); talloc_free((void *) s); } - NOPARSE_UNLESS(tr_cfg_parse_string(jlog, "console_threshold", &s)); + NOPARSE_UNLESS(tr_cfg_parse_string(jtmp, "console_threshold", &s)); if (s) { trc->internal->console_threshold = str2sev(s); talloc_free((void *) s); } } + /* Parse the monitoring section */ + if (NULL != (jtmp = json_object_get(jint, "monitoring"))) { + NOPARSE_UNLESS(tr_cfg_parse_unsigned(jtmp, "port", &(trc->internal->monitoring_port))); + } + tr_debug("tr_cfg_parse_internal: Internal config parsed."); return TR_CFG_SUCCESS; }