diff options
author | Kim Alvefur <zash@zash.se> | 2015-08-20 13:05:22 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2015-08-20 13:05:22 +0200 |
commit | 80c7d5155e9c468d86f3b268e90303decd7d1827 (patch) | |
tree | 103fd7d9396b60b9f76071a009c54d3ca9d35744 /core/configmanager.lua | |
parent | f1313996a2db339fe76f269353cc911c68316f30 (diff) | |
parent | c5e4af96d8bd9de7a96d3dc1eff5b8d1eecbfdaf (diff) | |
download | prosody-80c7d5155e9c468d86f3b268e90303decd7d1827.tar.gz prosody-80c7d5155e9c468d86f3b268e90303decd7d1827.zip |
Merge 0.10->trunk
Diffstat (limited to 'core/configmanager.lua')
-rw-r--r-- | core/configmanager.lua | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/core/configmanager.lua b/core/configmanager.lua index 5ee131ad..16d4b8e2 100644 --- a/core/configmanager.lua +++ b/core/configmanager.lua @@ -19,10 +19,11 @@ local resolve_relative_path = require"util.paths".resolve_relative_path; local glob_to_pattern = require"util.paths".glob_to_pattern; local path_sep = package.config:sub(1,1); -local have_encodings, encodings = pcall(require, "util.encodings"); -local nameprep = have_encodings and encodings.stringprep.nameprep or function (host) return host:lower(); end +local encodings = deps.softreq"util.encodings"; +local nameprep = encodings and encodings.stringprep.nameprep or function (host) return host:lower(); end -module "configmanager" +local _M = {}; +local _ENV = nil; _M.resolve_relative_path = resolve_relative_path; -- COMPAT @@ -34,11 +35,11 @@ local config = setmetatable({ ["*"] = { } }, config_mt); -- When host not found, use global local host_mt = { __index = function(_, k) return config["*"][k] end } -function getconfig() +function _M.getconfig() return config; end -function get(host, key, _oldkey) +function _M.get(host, key, _oldkey) if key == "core" then key = _oldkey; -- COMPAT with code that still uses "core" end @@ -73,7 +74,7 @@ function _M.set(host, key, value, _oldvalue) return set(config, host, key, value); end -function load(filename, config_format) +function _M.load(filename, config_format) config_format = config_format or filename:match("%w+$"); if parsers[config_format] and parsers[config_format].load then @@ -102,7 +103,7 @@ function load(filename, config_format) end end -function addparser(config_format, parser) +function _M.addparser(config_format, parser) if config_format and parser then parsers[config_format] = parser; end |