From 493c51c5e438fe2b7fe93885c23214c3ccafcc4c Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 15 Dec 2008 20:50:22 +0000 Subject: [PATCH] MODLANG-92 startup scripts do not honor the LUA_PATH and LUA_CPATH env vars git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10784 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/languages/mod_lua/mod_lua.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/mod/languages/mod_lua/mod_lua.cpp b/src/mod/languages/mod_lua/mod_lua.cpp index 37af26e23a..8a7aa89eb3 100644 --- a/src/mod/languages/mod_lua/mod_lua.cpp +++ b/src/mod/languages/mod_lua/mod_lua.cpp @@ -278,10 +278,6 @@ static switch_status_t do_config(void) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding '%s' to '%s'\n", globals.xml_handler, val); switch_xml_bind_search_function(lua_fetch, switch_xml_parse_section_string(val), NULL); } - } else if (!strcmp(var, "startup-script")) { - if (val) { - lua_thread(val); - } } else if (!strcmp(var, "module-directory") && !switch_strlen_zero(val)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "lua: appending module directory: '%s'\n", val); if(cpath_stream.data_len) { @@ -332,6 +328,19 @@ static switch_status_t do_config(void) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "lua: LUA_PATH set to: '%s'\n", (char *)path_stream.data); } } + + if ((settings = switch_xml_child(cfg, "settings"))) { + for (param = switch_xml_child(settings, "param"); param; param = param->next) { + char *var = (char *) switch_xml_attr_soft(param, "name"); + char *val = (char *) switch_xml_attr_soft(param, "value"); + if (!strcmp(var, "startup-script")) { + if (val) { + lua_thread(val); + } + } + } + } + switch_safe_free(path_stream.data); switch_xml_free(xml);