Software /
code /
prosody
Comparison
core/configmanager.lua @ 12440:1ef893715311 0.12
configmanager: Add method to report loaded config files (part of #1729 fix)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 28 Mar 2022 11:41:32 +0100 |
parent | 12083:ec21e379c145 |
child | 12448:fb7e76c1ad1c |
comparison
equal
deleted
inserted
replaced
12438:a698f65df453 | 12440:1ef893715311 |
---|---|
29 | 29 |
30 local parser = nil; | 30 local parser = nil; |
31 | 31 |
32 local config_mt = { __index = function (t, _) return rawget(t, "*"); end}; | 32 local config_mt = { __index = function (t, _) return rawget(t, "*"); end}; |
33 local config = setmetatable({ ["*"] = { } }, config_mt); | 33 local config = setmetatable({ ["*"] = { } }, config_mt); |
34 local files = {}; | |
34 | 35 |
35 -- When host not found, use global | 36 -- When host not found, use global |
36 local host_mt = { __index = function(_, k) return config["*"][k] end } | 37 local host_mt = { __index = function(_, k) return config["*"][k] end } |
37 | 38 |
38 function _M.getconfig() | 39 function _M.getconfig() |
94 if not config_format then | 95 if not config_format then |
95 return nil, "file", "no parser specified"; | 96 return nil, "file", "no parser specified"; |
96 else | 97 else |
97 return nil, "file", "no parser for "..(config_format); | 98 return nil, "file", "no parser for "..(config_format); |
98 end | 99 end |
100 end | |
101 | |
102 function _M.files() | |
103 return files; | |
99 end | 104 end |
100 | 105 |
101 -- Built-in Lua parser | 106 -- Built-in Lua parser |
102 do | 107 do |
103 local pcall = _G.pcall; | 108 local pcall = _G.pcall; |
251 | 256 |
252 if not ok then | 257 if not ok then |
253 return nil, err; | 258 return nil, err; |
254 end | 259 end |
255 | 260 |
261 t_insert(files, config_file); | |
262 | |
256 return true, warnings; | 263 return true, warnings; |
257 end | 264 end |
258 | 265 |
259 end | 266 end |
260 | 267 |