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[];
"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}
};
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");
}
}
+ 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");
}
"Enable verbose logging", NULL},
{"list-commands", 'l', 0, G_OPTION_ARG_NONE, &list_commands,
"List available commands", NULL},
- {"var", 0, 0, G_OPTION_ARG_CALLBACK, rspamadm_parse_ucl_var,
+ {"var", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer)rspamadm_parse_ucl_var,
"Redefine UCL variable", NULL},
{"help", 'h', 0, G_OPTION_ARG_NONE, &show_help,
"Show help", NULL},