File

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
child 214:7487f8b47662
line wrap: on
line source

local modulemanager = require "core.modulemanager";
local config = require "core.configmanager";

module.host = "*";

local function reload_components()
        module:log ("debug", "reload_components");

        local defined_hosts = config.getconfig();

        for host in pairs(defined_hosts) do
                module:log ("debug", "found host %s", host);
                if (not hosts[host] and host ~= "*") then
                        module:log ("debug", "found new host %s", host);
                        modulemanager.load(host, configmanager.get(host, "core", "component_module"));
                end
        end;

        return;
end

module:hook("config-reloaded", reload_components);