X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=core%2Fconfigmanager.lua;h=9720f48ac1156ed243b3d324f1cb968273c12ce9;hb=ea9c53231bbd3b3b280389b63380944f5b0fadb8;hp=a0a1f81708184c62b1b6d5def6d8dd5a9026c301;hpb=7eb15e3f95e7b5146d179d56df9b327fe067bb12;p=prosody.git diff --git a/core/configmanager.lua b/core/configmanager.lua index a0a1f817..9720f48a 100644 --- a/core/configmanager.lua +++ b/core/configmanager.lua @@ -7,8 +7,8 @@ -- local _G = _G; -local setmetatable, loadfile, pcall, rawget, rawset, io, error, dofile, type, pairs, table = - setmetatable, loadfile, pcall, rawget, rawset, io, error, dofile, type, pairs, table; +local setmetatable, rawget, rawset, io, error, dofile, type, pairs, table = + setmetatable, rawget, rawset, io, error, dofile, type, pairs, table; local format, math_max = string.format, math.max; local fire_event = prosody and prosody.events.fire_event or function () end; @@ -25,7 +25,7 @@ local config_mt = { __index = function (t, k) return rawget(t, "*"); end}; local config = setmetatable({ ["*"] = { } }, config_mt); -- When host not found, use global -local host_mt = { }; +local host_mt = { __index = function(_, k) return config["*"][k] end } function getconfig() return config; @@ -68,7 +68,6 @@ end -- Helper function to resolve relative paths (needed by config) do - local rel_path_start = ".."..path_sep; function resolve_relative_path(parent_path, path) if path then -- Some normalization @@ -152,7 +151,7 @@ end -- Built-in Lua parser do local pcall, setmetatable = _G.pcall, _G.setmetatable; - local rawget, tostring = _G.rawget, _G.tostring; + local rawget = _G.rawget; parsers.lua = {}; function parsers.lua.load(data, config_file, config) local env; @@ -213,7 +212,7 @@ do end env.component = env.Component; - function env.Include(file, wildcard) + function env.Include(file) if file:match("[*?]") then local path_pos, glob = file:match("()([^"..path_sep.."]+)$"); local path = file:sub(1, math_max(path_pos-2,0));