core/modulemanager.lua

changeset 637
30b8ad9f7b70
parent 615
4ae3e81513f3
child 670
d5cf10b7fc44
equal deleted inserted replaced
636:9c9c671ecc50 637:30b8ad9f7b70
51 51
52 local modulehelpers = setmetatable({}, { __index = _G }); 52 local modulehelpers = setmetatable({}, { __index = _G });
53 53
54 -- Load modules when a host is activated 54 -- Load modules when a host is activated
55 function load_modules_for_host(host) 55 function load_modules_for_host(host)
56 -- Load modules from global section
57 local modules_enabled = config.get("*", "core", "modules_enabled");
58 local modules_disabled = config.get(host, "core", "modules_disabled");
59 local disabled_set = {};
60 if modules_enabled then
61 if modules_disabled then
62 for _, module in pairs(modules_disabled) do
63 disabled_set[module] = true;
64 end
65 end
66 for _, module in pairs(modules_enabled) do
67 if not disabled_set[module] then
68 load(host, module);
69 end
70 end
71 end
72
73 -- Load modules from just this host
56 local modules_enabled = config.get(host, "core", "modules_enabled"); 74 local modules_enabled = config.get(host, "core", "modules_enabled");
57 if modules_enabled then 75 if modules_enabled then
58 for _, module in pairs(modules_enabled) do 76 for _, module in pairs(modules_enabled) do
59 load(host, module); 77 load(host, module);
60 end 78 end

mercurial