Fix splitting of PROSODY_COMPONENTS

Problem is that the code appears to expect multiple returns from the
`_split()` function but it returns an array, so we unpack that
presumably 2-item array into the parts expected.

Fixes #77
This commit is contained in:
Kim Alvefur
2025-04-21 19:50:21 +02:00
parent d5987023e2
commit ba105e7dee
3 changed files with 9 additions and 6 deletions
+3 -2
View File
@@ -12,6 +12,7 @@
-- The only thing left to do is rename this file to remove the .dist ending, and fill in the
-- blanks. Good luck, and happy Jabbering!
local _unpack = table.unpack or _G.unpack;
local function _split(s, sep)
if not s then return nil; end
sep = sep or ",";
@@ -266,7 +267,7 @@ end
-- For more information on components, see https://prosody.im/doc/components
for _, component_def in ipairs(_split(ENV_PROSODY_COMPONENTS) or {}) do
local c_name, c_type = _split(component_def, ":");
local c_name, c_type = _unpack(_split(component_def, ":"));
Component (c_name) (c_type)
if c_type == "muc" then
@@ -286,7 +287,7 @@ for _, component_def in ipairs(_split(ENV_PROSODY_COMPONENTS) or {}) do
end
for _, component_def in ipairs(_split(ENV_PROSODY_EXTERNAL_COMPONENTS) or {}) do
local c_name, c_secret = _split(component_def, ":");
local c_name, c_secret = _unpack(_split(component_def, ":"));
Component (c_name)
component_secret = c_secret or ENV_PROSODY_COMPONENT_SECRET
end
+3 -2
View File
@@ -12,6 +12,7 @@
-- The only thing left to do is rename this file to remove the .dist ending, and fill in the
-- blanks. Good luck, and happy Jabbering!
local _unpack = Lua.table.unpack;
local function _split(s, sep)
if not s then return nil; end
sep = sep or ",";
@@ -259,7 +260,7 @@ end
-- For more information on components, see https://prosody.im/doc/components
for _, component_def in Lua.ipairs(_split(ENV_PROSODY_COMPONENTS) or {}) do
local c_name, c_type = _split(component_def, ":");
local c_name, c_type = _unpack(_split(component_def, ":"));
Component (c_name) (c_type)
if c_type == "muc" then
@@ -279,7 +280,7 @@ for _, component_def in Lua.ipairs(_split(ENV_PROSODY_COMPONENTS) or {}) do
end
for _, component_def in Lua.ipairs(_split(ENV_PROSODY_EXTERNAL_COMPONENTS) or {}) do
local c_name, c_secret = _split(component_def, ":");
local c_name, c_secret = _unpack(_split(component_def, ":"));
Component (c_name)
component_secret = c_secret or ENV_PROSODY_COMPONENT_SECRET
end
+3 -2
View File
@@ -12,6 +12,7 @@
-- The only thing left to do is rename this file to remove the .dist ending, and fill in the
-- blanks. Good luck, and happy Jabbering!
local _unpack = Lua.table.unpack;
local function _split(s, sep)
if not s then return nil; end
sep = sep or ",";
@@ -259,7 +260,7 @@ end
-- For more information on components, see https://prosody.im/doc/components
for _, component_def in Lua.ipairs(_split(ENV_PROSODY_COMPONENTS) or {}) do
local c_name, c_type = _split(component_def, ":");
local c_name, c_type = _unpack(_split(component_def, ":"));
Component (c_name) (c_type)
if c_type == "muc" then
@@ -279,7 +280,7 @@ for _, component_def in Lua.ipairs(_split(ENV_PROSODY_COMPONENTS) or {}) do
end
for _, component_def in Lua.ipairs(_split(ENV_PROSODY_EXTERNAL_COMPONENTS) or {}) do
local c_name, c_secret = _split(component_def, ":");
local c_name, c_secret = _unpack(_split(component_def, ":"));
Component (c_name)
component_secret = c_secret or ENV_PROSODY_COMPONENT_SECRET
end