]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Read lua path settings from environment as well
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 4 Nov 2017 12:41:56 +0000 (12:41 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 4 Nov 2017 12:41:56 +0000 (12:41 +0000)
src/lua/lua_common.c

index 30b8aeb2ddb2f290c89315f81b69f5a83bd6fb57..3272ee2548ac3143e654029105d6088737bdf727 100644 (file)
@@ -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;