From e8366d156e09eba81ae38f57c41c74ec203c27bc Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 29 May 2018 16:58:54 +0100 Subject: [Minor] Rework config load routines --- src/libserver/cfg_rcl.h | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'src/libserver/cfg_rcl.h') diff --git a/src/libserver/cfg_rcl.h b/src/libserver/cfg_rcl.h index c1d958efc..8661687a3 100644 --- a/src/libserver/cfg_rcl.h +++ b/src/libserver/cfg_rcl.h @@ -446,11 +446,40 @@ gboolean rspamd_rcl_add_lua_plugins_path (struct rspamd_config *cfg, const gchar *path, GError **err); + +/** + * Calls for an external lua function to apply potential config transformations + * if needed. This function can change the cfg->rcl_obj. + * + * Example of transformation function: + * + * function(obj) + * if obj.something == 'foo' then + * obj.something = "bla" + * return true, obj + * end + * + * return false, nil + * end + * + * If function returns 'false' then rcl_obj is not touched. Otherwise, + * it is changed, then rcl_obj is imported from lua. Old config is dereferenced. + * @param cfg + */ +void rspamd_rcl_maybe_apply_lua_transform (struct rspamd_config *cfg); + +void rspamd_config_calculate_cksum (struct rspamd_config *cfg); + /* * Read configuration file */ +gboolean rspamd_config_parse_ucl (struct rspamd_config *cfg, + const gchar *filename, + GHashTable *vars, + GError **err); gboolean rspamd_config_read (struct rspamd_config *cfg, - const gchar *filename, const gchar *convert_to, - rspamd_rcl_section_fin_t logger_fin, gpointer logger_ud, - GHashTable *vars); + const gchar *filename, + rspamd_rcl_section_fin_t logger_fin, + gpointer logger_ud, + GHashTable *vars); #endif /* CFG_RCL_H_ */ -- cgit v1.2.3