aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-03-23 04:17:39 +0100
committerKim Alvefur <zash@zash.se>2013-03-23 04:17:39 +0100
commit983891c9fa8e728aa4680aedc74ec50a0329346e (patch)
treefc52870bbca26966e739b1654dd7ff728fbbd9e0 /core
parent4adcfb2d185bb95ec430822c772f091b713faa7a (diff)
parent869da6c240dccfed8c43228ceb989af5faf6c8f1 (diff)
downloadprosody-983891c9fa8e728aa4680aedc74ec50a0329346e.tar.gz
prosody-983891c9fa8e728aa4680aedc74ec50a0329346e.zip
Merge 0.9->trunk
Diffstat (limited to 'core')
-rw-r--r--core/certmanager.lua4
-rw-r--r--core/configmanager.lua2
-rw-r--r--core/hostmanager.lua2
-rw-r--r--core/loggingmanager.lua4
-rw-r--r--core/moduleapi.lua7
-rw-r--r--core/modulemanager.lua12
-rw-r--r--core/sessionmanager.lua2
-rw-r--r--core/usermanager.lua12
8 files changed, 21 insertions, 24 deletions
diff --git a/core/certmanager.lua b/core/certmanager.lua
index 8607e618..b91f7110 100644
--- a/core/certmanager.lua
+++ b/core/certmanager.lua
@@ -27,7 +27,7 @@ end
module "certmanager"
-- Global SSL options if not overridden per-host
-local default_ssl_config = configmanager.get("*", "core", "ssl");
+local default_ssl_config = configmanager.get("*", "ssl");
local default_capath = "/etc/ssl/certs";
local default_verify = (ssl and ssl.x509 and { "peer", "client_once", }) or "none";
local default_options = { "no_sslv2", luasec_has_noticket and "no_ticket" or nil };
@@ -100,7 +100,7 @@ function create_context(host, mode, user_ssl_config)
end
function reload_ssl_config()
- default_ssl_config = configmanager.get("*", "core", "ssl");
+ default_ssl_config = configmanager.get("*", "ssl");
end
prosody.events.add_handler("config-reloaded", reload_ssl_config);
diff --git a/core/configmanager.lua b/core/configmanager.lua
index a0a1f817..e31dbd72 100644
--- a/core/configmanager.lua
+++ b/core/configmanager.lua
@@ -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;
diff --git a/core/hostmanager.lua b/core/hostmanager.lua
index 40401e48..06ba72a1 100644
--- a/core/hostmanager.lua
+++ b/core/hostmanager.lua
@@ -74,7 +74,7 @@ function activate(host, host_config)
host = host;
s2sout = {};
events = events_new();
- dialback_secret = configmanager.get(host, "core", "dialback_secret") or uuid_gen();
+ dialback_secret = configmanager.get(host, "dialback_secret") or uuid_gen();
send = host_send;
modules = {};
};
diff --git a/core/loggingmanager.lua b/core/loggingmanager.lua
index c3fc83e4..c69dede8 100644
--- a/core/loggingmanager.lua
+++ b/core/loggingmanager.lua
@@ -146,7 +146,7 @@ function reload_logging()
logger.reset();
- local debug_mode = config.get("*", "core", "debug");
+ local debug_mode = config.get("*", "debug");
default_logging = { { to = "console" , levels = { min = (debug_mode and "debug") or "info" } } };
default_file_logging = {
@@ -154,7 +154,7 @@ function reload_logging()
};
default_timestamp = "%b %d %H:%M:%S";
- logging_config = config.get("*", "core", "log") or default_logging;
+ logging_config = config.get("*", "log") or default_logging;
for name, sink_maker in pairs(old_sink_types) do
diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index 20898fcf..f9701471 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -167,12 +167,9 @@ function api:shared(...)
end
function api:get_option(name, default_value)
- local value = config.get(self.host, self.name, name);
+ local value = config.get(self.host, name);
if value == nil then
- value = config.get(self.host, "core", name);
- if value == nil then
- value = default_value;
- end
+ value = default_value;
end
return value;
end
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 4ba2c27e..35b9d0e5 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -44,12 +44,12 @@ local modulemap = { ["*"] = {} };
-- Load modules when a host is activated
function load_modules_for_host(host)
- local component = config.get(host, "core", "component_module");
+ local component = config.get(host, "component_module");
- local global_modules_enabled = config.get("*", "core", "modules_enabled");
- local global_modules_disabled = config.get("*", "core", "modules_disabled");
- local host_modules_enabled = config.get(host, "core", "modules_enabled");
- local host_modules_disabled = config.get(host, "core", "modules_disabled");
+ local global_modules_enabled = config.get("*", "modules_enabled");
+ local global_modules_disabled = config.get("*", "modules_disabled");
+ local host_modules_enabled = config.get(host, "modules_enabled");
+ local host_modules_disabled = config.get(host, "modules_disabled");
if host_modules_enabled == global_modules_enabled then host_modules_enabled = nil; end
if host_modules_disabled == global_modules_disabled then host_modules_disabled = nil; end
@@ -218,7 +218,7 @@ local function do_reload_module(host, name)
saved = ret;
else
log("warn", "Error saving module '%s:%s' state: %s", host, name, ret);
- if not config.get(host, "core", "force_module_reload") then
+ if not config.get(host, "force_module_reload") then
log("warn", "Aborting reload due to error, set force_module_reload to ignore this");
return nil, "save-state-failed";
else
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua
index 05b2d64b..e721835d 100644
--- a/core/sessionmanager.lua
+++ b/core/sessionmanager.lua
@@ -140,7 +140,7 @@ function bind_resource(session, resource)
local sessions = hosts[session.host].sessions[session.username].sessions;
if sessions[resource] then
-- Resource conflict
- local policy = config_get(session.host, "core", "conflict_resolve");
+ local policy = config_get(session.host, "conflict_resolve");
local increment;
if policy == "random" then
resource = uuid_generate();
diff --git a/core/usermanager.lua b/core/usermanager.lua
index 417d7037..08343bee 100644
--- a/core/usermanager.lua
+++ b/core/usermanager.lua
@@ -42,8 +42,8 @@ function initialize_host(host)
host_session.events.add_handler("item-added/auth-provider", function (event)
local provider = event.item;
- local auth_provider = config.get(host, "core", "authentication") or default_provider;
- if config.get(host, "core", "anonymous_login") then
+ local auth_provider = config.get(host, "authentication") or default_provider;
+ if config.get(host, "anonymous_login") then
log("error", "Deprecated config option 'anonymous_login'. Use authentication = 'anonymous' instead.");
auth_provider = "anonymous";
end -- COMPAT 0.7
@@ -61,8 +61,8 @@ function initialize_host(host)
end
end);
host_session.users = new_null_provider(); -- Start with the default usermanager provider
- local auth_provider = config.get(host, "core", "authentication") or default_provider;
- if config.get(host, "core", "anonymous_login") then auth_provider = "anonymous"; end -- COMPAT 0.7
+ local auth_provider = config.get(host, "authentication") or default_provider;
+ if config.get(host, "anonymous_login") then auth_provider = "anonymous"; end -- COMPAT 0.7
if auth_provider ~= "null" then
modulemanager.load(host, "auth_"..auth_provider);
end
@@ -116,8 +116,8 @@ function is_admin(jid, host)
jid = jid_bare(jid);
host = host or "*";
- local host_admins = config.get(host, "core", "admins");
- local global_admins = config.get("*", "core", "admins");
+ local host_admins = config.get(host, "admins");
+ local global_admins = config.get("*", "admins");
if host_admins and host_admins ~= global_admins then
if type(host_admins) == "table" then