diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2018-09-13 15:01:13 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-12-13 15:02:55 +0100 |
commit | 816c65ed373288974b2276f5fbb4a3131a447f77 (patch) | |
tree | 81b92b5e1bef596434b45406421c5793ed0c0cda /ctl-lib/ctl-config.c | |
parent | 7387497703fc8a26eaacb7e974137ea78e02514d (diff) |
Add ctlPlugins array to the ctlConfig structure
This lets you add new actions to a section from a plugin,
typically at its init step.
Change-Id: I33a61c6162d25332d680d8a0e2d1841a457e0e80
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'ctl-lib/ctl-config.c')
-rw-r--r-- | ctl-lib/ctl-config.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ctl-lib/ctl-config.c b/ctl-lib/ctl-config.c index 339b14c..e815f2c 100644 --- a/ctl-lib/ctl-config.c +++ b/ctl-lib/ctl-config.c @@ -151,10 +151,9 @@ int CtlConfigExec(AFB_ApiT apiHandle, CtlConfigT *ctlConfig) { // Loop on every section and process config int errcount=0; for (int idx = 0; ctlConfig->sections[idx].key != NULL; idx++) { - if (!ctlConfig->sections[idx].loadCB) AFB_ApiNotice(apiHandle, "CtlConfigLoad: notice empty section '%s'", ctlConfig->sections[idx].key); - else if (json_object_object_get_ex(ctlConfig->configJ, ctlConfig->sections[idx].key, NULL)) + else if (ctlConfig->sections[idx].actions) errcount += ctlConfig->sections[idx].loadCB(apiHandle, &ctlConfig->sections[idx], NULL); } @@ -186,6 +185,8 @@ CtlConfigT *CtlLoadMetaDataJson(AFB_ApiT apiHandle, json_object *ctlConfigJ, con ctlHandle->configJ = ctlConfigJ; ctlHandle->prefix = prefix; + ctlHandle->ctlPlugins = &ctlPlugins; + return ctlHandle; } |