From: Vsevolod Stakhov Date: Sat, 4 Nov 2017 12:41:56 +0000 (+0000) Subject: [Minor] Read lua path settings from environment as well X-Git-Tag: 1.7.0~487 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4d589bd8919effafcdb79005a3c2a5eb461480f3;p=thirdparty%2Frspamd.git [Minor] Read lua path settings from environment as well --- diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c index 30b8aeb2dd..3272ee2548 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;