Software /
code /
prosody
Comparison
core/configmanager.lua @ 12531:32bcb899526f
core.configmanager: Remove COMPAT for old config format from 2013
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 29 May 2022 16:06:42 +0200 |
parent | 12448:fb7e76c1ad1c |
child | 12972:ead41e25ebc0 |
comparison
equal
deleted
inserted
replaced
12530:79431e0282a9 | 12531:32bcb899526f |
---|---|
38 | 38 |
39 function _M.getconfig() | 39 function _M.getconfig() |
40 return config; | 40 return config; |
41 end | 41 end |
42 | 42 |
43 function _M.get(host, key, _oldkey) | 43 function _M.get(host, key) |
44 if key == "core" then | |
45 key = _oldkey; -- COMPAT with code that still uses "core" | |
46 end | |
47 return config[host][key]; | 44 return config[host][key]; |
48 end | 45 end |
49 function _M.rawget(host, key, _oldkey) | 46 function _M.rawget(host, key) |
50 if key == "core" then | |
51 key = _oldkey; -- COMPAT with code that still uses "core" | |
52 end | |
53 local hostconfig = rawget(config, host); | 47 local hostconfig = rawget(config, host); |
54 if hostconfig then | 48 if hostconfig then |
55 return rawget(hostconfig, key); | 49 return rawget(hostconfig, key); |
56 end | 50 end |
57 end | 51 end |
66 return true; | 60 return true; |
67 end | 61 end |
68 return false; | 62 return false; |
69 end | 63 end |
70 | 64 |
71 function _M.set(host, key, value, _oldvalue) | 65 function _M.set(host, key, value) |
72 if key == "core" then | |
73 key, value = value, _oldvalue; --COMPAT with code that still uses "core" | |
74 end | |
75 return set(config, host, key, value); | 66 return set(config, host, key, value); |
76 end | 67 end |
77 | 68 |
78 function _M.load(filename, config_format) | 69 function _M.load(filename, config_format) |
79 config_format = config_format or filename:match("%w+$"); | 70 config_format = config_format or filename:match("%w+$"); |