]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Export rspamd paths to lua.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 12 Jun 2013 14:59:12 +0000 (15:59 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 12 Jun 2013 14:59:12 +0000 (15:59 +0100)
config.h.in
src/lua/lua_cfg_file.c

index d959da5b0ec3bbaa5800aefdf7aa5aa49a5f1707..b7fae4c6dc3c1234e60707adeed276366896d74b 100644 (file)
 #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;
index 63728a004d31b37cfa70e21a67b1c02d0eee0d03..b23ba10f8a0b406c63ee6789bd7ab0617d41d264 100644 (file)
@@ -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);