aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-12-29 17:13:41 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-12-29 17:13:41 +0000
commitc98248f120f7795a057b5c2bbd46b90550946abe (patch)
tree5a8e253dc3447eade4fdade6eeb1b0238c5bfe50
parente365dd860c0e666c11d15bc57a5d18912e8c0115 (diff)
downloadrspamd-c98248f120f7795a057b5c2bbd46b90550946abe.tar.gz
rspamd-c98248f120f7795a057b5c2bbd46b90550946abe.zip
Add options for workers
-rw-r--r--src/libserver/cfg_rcl.c22
-rw-r--r--src/rspamadm/confighelp.c7
2 files changed, 29 insertions, 0 deletions
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index a8fd2ee91..2a35a554e 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -2747,6 +2747,8 @@ rspamd_rcl_register_worker_option (struct rspamd_config *cfg,
struct rspamd_worker_param_parser *nhandler;
struct rspamd_worker_cfg_parser *nparser;
struct rspamd_worker_param_key srch;
+ const ucl_object_t *doc_workers, *doc_target;
+ ucl_object_t *doc_obj;
nparser = g_hash_table_lookup (cfg->wrk_parsers, &type);
@@ -2780,6 +2782,26 @@ rspamd_rcl_register_worker_option (struct rspamd_config *cfg,
nhandler->handler = handler;
g_hash_table_insert (nparser->parsers, &nhandler->key, nhandler);
+
+ doc_workers = ucl_object_find_key (cfg->doc_strings, "workers");
+
+ if (doc_workers == NULL) {
+ doc_obj = ucl_object_typed_new (UCL_OBJECT);
+ ucl_object_insert_key (cfg->doc_strings, doc_obj, "workers", 0, false);
+ doc_workers = doc_obj;
+ }
+
+ doc_target = ucl_object_find_key (doc_workers, g_quark_to_string (type));
+
+ if (doc_target == NULL) {
+ doc_obj = ucl_object_typed_new (UCL_OBJECT);
+ ucl_object_insert_key ((ucl_object_t *)doc_workers, doc_obj,
+ g_quark_to_string (type), 0, true);
+ doc_target = doc_obj;
+ }
+
+ rspamd_rcl_add_doc_obj ((ucl_object_t *)doc_target, doc_string, name, UCL_NULL,
+ handler, flags);
}
diff --git a/src/rspamadm/confighelp.c b/src/rspamadm/confighelp.c
index 870676e9f..c76f580e7 100644
--- a/src/rspamadm/confighelp.c
+++ b/src/rspamadm/confighelp.c
@@ -218,6 +218,13 @@ rspamadm_confighelp (gint argc, gchar **argv)
exit (1);
}
+ pworker = &workers[0];
+ while (*pworker) {
+ /* Init string quarks */
+ (void) g_quark_from_static_string ((*pworker)->name);
+ pworker++;
+ }
+
cfg = rspamd_config_new ();
cfg->compiled_modules = modules;
cfg->compiled_workers = workers;