aboutsummaryrefslogtreecommitdiffstats
path: root/src/rspamadm/configtest.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-09-25 13:26:13 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-09-25 13:26:13 +0100
commit00607a4168ebb1e46a23ea8a9cfb357fd7e26a5d (patch)
tree5fba426237c48fa92d49889e8f487b92b12369db /src/rspamadm/configtest.c
parentc742eeba369cfce062f2464c8cb3e62405025185 (diff)
downloadrspamd-00607a4168ebb1e46a23ea8a9cfb357fd7e26a5d.tar.gz
rspamd-00607a4168ebb1e46a23ea8a9cfb357fd7e26a5d.zip
Add strict mode for configtest.
Diffstat (limited to 'src/rspamadm/configtest.c')
-rw-r--r--src/rspamadm/configtest.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/rspamadm/configtest.c b/src/rspamadm/configtest.c
index 1e70f1cc0..1de694975 100644
--- a/src/rspamadm/configtest.c
+++ b/src/rspamadm/configtest.c
@@ -30,6 +30,7 @@
static gboolean quiet = FALSE;
static gchar *config = NULL;
+static gboolean strict = FALSE;
extern struct rspamd_main *rspamd_main;
/* Defined in modules.c */
extern module_t *modules[];
@@ -50,6 +51,8 @@ static GOptionEntry entries[] = {
"Supress output", NULL},
{"config", 'c', 0, G_OPTION_ARG_STRING, &config,
"Config file to test", NULL},
+ {"strict", 's', 0, G_OPTION_ARG_NONE, &strict,
+ "Stop on any error in config", NULL},
{NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL}
};
@@ -104,6 +107,7 @@ rspamadm_configtest (gint argc, gchar **argv)
struct rspamd_config *cfg = rspamd_main->cfg;
gboolean ret = FALSE;
worker_t **pworker;
+ const guint64 *log_cnt;
context = g_option_context_new (
"keypair - create encryption keys");
@@ -167,6 +171,17 @@ rspamadm_configtest (gint argc, gchar **argv)
}
}
+ if (strict && ret) {
+ log_cnt = rspamd_log_counters (rspamd_main->logger);
+
+ if (log_cnt && log_cnt[0] > 0) {
+ if (!quiet) {
+ rspamd_printf ("%L errors found\n", log_cnt[0]);
+ }
+ ret = FALSE;
+ }
+ }
+
if (!quiet) {
rspamd_printf ("syntax %s\n", ret ? "OK" : "BAD");
}