Mercurial > prosody-hg
comparison core/configmanager.lua @ 5380:e119e378b1d9
configmanager: Fix so unset variables are searched for in the global section
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 23 Mar 2013 04:14:52 +0100 |
| parents | ac530c44772e |
| children | 0bf5e90be086 |
comparison
equal
deleted
inserted
replaced
| 5379:27de7cc94111 | 5380:e119e378b1d9 |
|---|---|
| 23 | 23 |
| 24 local config_mt = { __index = function (t, k) return rawget(t, "*"); end}; | 24 local config_mt = { __index = function (t, k) return rawget(t, "*"); end}; |
| 25 local config = setmetatable({ ["*"] = { } }, config_mt); | 25 local config = setmetatable({ ["*"] = { } }, config_mt); |
| 26 | 26 |
| 27 -- When host not found, use global | 27 -- When host not found, use global |
| 28 local host_mt = { }; | 28 local host_mt = { __index = function(_, k) return config["*"][k] end } |
| 29 | 29 |
| 30 function getconfig() | 30 function getconfig() |
| 31 return config; | 31 return config; |
| 32 end | 32 end |
| 33 | 33 |
