core/hostmanager.lua

changeset 2877
1edeb8fe7d14
parent 2767
473627393d40
parent 2855
66a1aa0bedc0
child 2923
b7049746bd29
equal deleted inserted replaced
2813:46dfcc33ea9e 2877:1edeb8fe7d14
31 31
32 local hosts_loaded_once; 32 local hosts_loaded_once;
33 33
34 local function load_enabled_hosts(config) 34 local function load_enabled_hosts(config)
35 local defined_hosts = config or configmanager.getconfig(); 35 local defined_hosts = config or configmanager.getconfig();
36 local activated_any_host;
36 37
37 for host, host_config in pairs(defined_hosts) do 38 for host, host_config in pairs(defined_hosts) do
38 if host ~= "*" and (host_config.core.enabled == nil or host_config.core.enabled) and not host_config.core.component_module then 39 if host ~= "*" and (host_config.core.enabled == nil or host_config.core.enabled) and not host_config.core.component_module then
40 activated_any_host = true;
39 activate(host, host_config); 41 activate(host, host_config);
40 end 42 end
41 end 43 end
44
45 if not activated_any_host then
46 log("error", "No hosts defined in the config file. This may cause unexpected behaviour as no modules will be loaded.");
47 end
48
42 eventmanager.fire_event("hosts-activated", defined_hosts); 49 eventmanager.fire_event("hosts-activated", defined_hosts);
43 hosts_loaded_once = true; 50 hosts_loaded_once = true;
44 end 51 end
45 52
46 eventmanager.add_event_hook("server-starting", load_enabled_hosts); 53 eventmanager.add_event_hook("server-starting", load_enabled_hosts);

mercurial