diff options
-rw-r--r-- | config.h.in | 7 | ||||
-rw-r--r-- | src/lua/lua_cfg_file.c | 8 |
2 files changed, 12 insertions, 3 deletions
diff --git a/config.h.in b/config.h.in index d959da5b0..b7fae4c6d 100644 --- a/config.h.in +++ b/config.h.in @@ -198,6 +198,10 @@ #cmakedefine GLIB_HASH_COMPAT 1 #cmakedefine PARAM_H_HAS_BITSET 1 +#define ETC_PREFIX "${ETC_PREFIX}" +#define LOCALSTATES_PREFIX "${LOCALSTATES_PREFIX}" +#define CMAKE_PREFIX "${CMAKE_INSTALL_PREFIX}" + #define RVERSION "${RSPAMD_VERSION}" #define RID "${ID}" #define RSPAMD_MASTER_SITE_URL "${RSPAMD_MASTER_SITE_URL}" @@ -441,9 +445,6 @@ typedef off_t goffset; #include <gmime/gmime.h> #endif -#define CMAKE_PREFIX "${CMAKE_INSTALL_PREFIX}" -#define ETC_PREFIX "${ETC_PREFIX}" - /* Forwarded declaration */ struct module_ctx; struct config_file; diff --git a/src/lua/lua_cfg_file.c b/src/lua/lua_cfg_file.c index 63728a004..b23ba10f8 100644 --- a/src/lua/lua_cfg_file.c +++ b/src/lua/lua_cfg_file.c @@ -481,6 +481,14 @@ lua_check_condition (struct config_file *cfg, const gchar *condition) lua_pushstring (L, ""); lua_setglobal (L, "osrelease"); #endif + + /* Rspamd paths */ + lua_newtable (L); + lua_set_table_index (L, "etcdir", ETC_PREFIX); + lua_set_table_index (L, "prefix", CMAKE_PREFIX); + lua_set_table_index (L, "localstatesdir", LOCALSTATES_PREFIX); + lua_setglobal (L, "rspamd_paths"); + /* Make fake string */ hostlen = sizeof (FAKE_RES_VAR "=") + strlen (condition); condbuf = g_malloc (hostlen); |