Mercurial > prosody-modules
comparison mod_s2s_reload_newcomponent/mod_s2s_reload_newcomponent.lua @ 213:89051a926f74
initial creation of module for reloading new components
user: Gaurav <gauravsri@gmail.com>
branch 'default'
added mod_s2s_reload_newcomponent/mod_s2s_reload_newcomponent.lua
author | Gaurav <gauravsri@gmail.com> |
---|---|
date | Fri, 16 Jul 2010 01:19:49 -0700 |
parents | |
children | 7487f8b47662 |
comparison
equal
deleted
inserted
replaced
212:16b76c7b6316 | 213:89051a926f74 |
---|---|
1 local modulemanager = require "core.modulemanager"; | |
2 local config = require "core.configmanager"; | |
3 | |
4 module.host = "*"; | |
5 | |
6 local function reload_components() | |
7 module:log ("debug", "reload_components"); | |
8 | |
9 local defined_hosts = config.getconfig(); | |
10 | |
11 for host in pairs(defined_hosts) do | |
12 module:log ("debug", "found host %s", host); | |
13 if (not hosts[host] and host ~= "*") then | |
14 module:log ("debug", "found new host %s", host); | |
15 modulemanager.load(host, configmanager.get(host, "core", "component_module")); | |
16 end | |
17 end; | |
18 | |
19 return; | |
20 end | |
21 | |
22 module:hook("config-reloaded", reload_components); | |
23 |