From 4d589bd8919effafcdb79005a3c2a5eb461480f3 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 4 Nov 2017 12:41:56 +0000 Subject: [PATCH] [Minor] Read lua path settings from environment as well --- src/lua/lua_common.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c index 30b8aeb2d..3272ee254 100644 --- a/src/lua/lua_common.c +++ b/src/lua/lua_common.c @@ -218,6 +218,7 @@ rspamd_lua_set_path (lua_State *L, struct rspamd_config *cfg, GHashTable *vars) *rulesdir = RSPAMD_RULESDIR, *lualibdir = RSPAMD_LUALIBDIR, *libdir = RSPAMD_LIBDIR; + const gchar *t; gchar path_buf[PATH_MAX]; @@ -241,9 +242,33 @@ rspamd_lua_set_path (lua_State *L, struct rspamd_config *cfg, GHashTable *vars) } } - if (vars) { - gchar *t; + /* Try environment */ + t = getenv ("PLUGINSDIR"); + if (t) { + pluginsdir = t; + } + + t = getenv ("RULESDIR"); + if (t) { + rulesdir = t; + } + + t = getenv ("LUALIBDIR"); + if (t) { + lualibdir = t; + } + t = getenv ("LIBDIR"); + if (t) { + libdir = t; + } + + t = getenv ("RSPAMD_LIBDIR"); + if (t) { + libdir = t; + } + + if (vars) { t = g_hash_table_lookup (vars, "PLUGINSDIR"); if (t) { pluginsdir = t; -- 2.39.5