diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-05-29 16:58:54 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-05-29 16:58:54 +0100 |
commit | e8366d156e09eba81ae38f57c41c74ec203c27bc (patch) | |
tree | 4e288c722057cf3948eeb659b4352b40b4eb9dbb /src/libserver/cfg_rcl.h | |
parent | 099cb8fb099054d2711c61ebfac1be05f9519748 (diff) | |
download | rspamd-e8366d156e09eba81ae38f57c41c74ec203c27bc.tar.gz rspamd-e8366d156e09eba81ae38f57c41c74ec203c27bc.zip |
[Minor] Rework config load routines
Diffstat (limited to 'src/libserver/cfg_rcl.h')
-rw-r--r-- | src/libserver/cfg_rcl.h | 35 |
1 files changed, 32 insertions, 3 deletions
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_ */ |