diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-11-04 12:41:56 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-11-04 12:41:56 +0000 |
commit | 4d589bd8919effafcdb79005a3c2a5eb461480f3 (patch) | |
tree | 07069bac7bd8f6490788a7f6d17cffb89484ee28 | |
parent | 54adbd226d3d0e72078047a36021aed9cc610c90 (diff) | |
download | rspamd-4d589bd8919effafcdb79005a3c2a5eb461480f3.tar.gz rspamd-4d589bd8919effafcdb79005a3c2a5eb461480f3.zip |
[Minor] Read lua path settings from environment as well
-rw-r--r-- | src/lua/lua_common.c | 29 |
1 files 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; |