}
close (fd);
- ext = get_filename_extension (filename);
- if (ext != NULL && strcmp (ext, "xml") == 0) {
+ if (convert_to != NULL) {
is_xml = TRUE;
}
+ else {
+ ext = get_filename_extension (filename);
+ if (ext != NULL && strcmp (ext, "xml") == 0) {
+ is_xml = TRUE;
+ }
+ }
if (is_xml) {
/* Prepare xml parser */
return FALSE;
}
- top = rspamd_rcl_config_init ();
- err = NULL;
-
- if (!rspamd_read_rcl_config (top, cfg, cfg->rcl_obj, &err)) {
- msg_err ("rcl parse error: %s", err->message);
- return FALSE;
- }
-
if (is_xml && convert_to != NULL) {
/* Convert XML config to UCL */
rcl = ucl_object_emit (cfg->rcl_obj, UCL_EMIT_CONFIG);
else if (write (fd, rcl, strlen (rcl)) == -1) {
msg_err ("cannot write rcl %s: %s", convert_to, strerror (errno));
}
+ else {
+ msg_info ("dumped xml configuration %s to ucl configuration %s",
+ filename, convert_to);
+ }
close (fd);
free (rcl);
}
}
+ top = rspamd_rcl_config_init ();
+ err = NULL;
+
+ if (!rspamd_read_rcl_config (top, cfg, cfg->rcl_obj, &err)) {
+ msg_err ("rcl parse error: %s", err->message);
+ return FALSE;
+ }
+
return TRUE;
}
rspamd_main->cfg->log_level = G_LOG_LEVEL_DEBUG;
}
else {
- rspamd_main->cfg->log_level = G_LOG_LEVEL_CRITICAL;
+ rspamd_main->cfg->log_level = G_LOG_LEVEL_INFO;
}
type = g_quark_from_static_string ("main");