aboutsummaryrefslogtreecommitdiffstats
path: root/core/configmanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-10-08 03:19:20 +0100
committerMatthew Wild <mwild1@gmail.com>2010-10-08 03:19:20 +0100
commit7d4005fc7de772f85b18662daaa18d9317600e8a (patch)
treebc4c4d24abbedc18c392a58db57ad978742ce72e /core/configmanager.lua
parenta60d832a399a03d12532b7ce6ada6a203d56eb1e (diff)
downloadprosody-7d4005fc7de772f85b18662daaa18d9317600e8a.tar.gz
prosody-7d4005fc7de772f85b18662daaa18d9317600e8a.zip
configmanager: Allow VirtualHost/Component definitions to be followed by a table of config options
Diffstat (limited to 'core/configmanager.lua')
-rw-r--r--core/configmanager.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/configmanager.lua b/core/configmanager.lua
index 6b181443..87c78aee 100644
--- a/core/configmanager.lua
+++ b/core/configmanager.lua
@@ -137,6 +137,12 @@ do
rawset(env, "__currenthost", name);
-- Needs at least one setting to logically exist :)
set(name or "*", "core", "defined", true);
+ return function (config_options)
+ rawset(env, "__currenthost", "*"); -- Return to global scope
+ for option_name, option_value in pairs(config_options) do
+ set(name or "*", "core", option_name, option_value);
+ end
+ end;
end
env.Host, env.host = env.VirtualHost, env.VirtualHost;
@@ -149,11 +155,19 @@ do
-- Don't load the global modules by default
set(name, "core", "load_global_modules", false);
rawset(env, "__currenthost", name);
+ local function handle_config_options(config_options)
+ rawset(env, "__currenthost", "*"); -- Return to global scope
+ for option_name, option_value in pairs(config_options) do
+ set(name or "*", "core", option_name, option_value);
+ end
+ end
return function (module)
if type(module) == "string" then
set(name, "core", "component_module", module);
+ return handle_config_options;
end
+ return handle_config_options(module);
end
end
env.component = env.Component;