Software /
code /
prosody
Comparison
core/hostmanager.lua @ 2617:0888bb4e817d
hostmanager: Log an error if no hosts are defined
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 12 Feb 2010 12:43:50 +0000 |
parent | 2555:9b9e4d8704f9 |
child | 2618:b8f6aa70d019 |
comparison
equal
deleted
inserted
replaced
2616:58148ad08af5 | 2617:0888bb4e817d |
---|---|
30 | 30 |
31 local hosts_loaded_once; | 31 local hosts_loaded_once; |
32 | 32 |
33 local function load_enabled_hosts(config) | 33 local function load_enabled_hosts(config) |
34 local defined_hosts = config or configmanager.getconfig(); | 34 local defined_hosts = config or configmanager.getconfig(); |
35 local activated_any_host; | |
35 | 36 |
36 for host, host_config in pairs(defined_hosts) do | 37 for host, host_config in pairs(defined_hosts) do |
37 if host ~= "*" and (host_config.core.enabled == nil or host_config.core.enabled) and not host_config.core.component_module then | 38 if host ~= "*" and (host_config.core.enabled == nil or host_config.core.enabled) and not host_config.core.component_module then |
39 activated_any_host = true; | |
38 activate(host, host_config); | 40 activate(host, host_config); |
39 end | 41 end |
40 end | 42 end |
43 | |
44 if not activated_any_host then | |
45 log("error", "No hosts defined in the config file. This may cause unexpected behaviour as no modules will be loaded."); | |
46 end | |
47 | |
41 eventmanager.fire_event("hosts-activated", defined_hosts); | 48 eventmanager.fire_event("hosts-activated", defined_hosts); |
42 hosts_loaded_once = true; | 49 hosts_loaded_once = true; |
43 end | 50 end |
44 | 51 |
45 eventmanager.add_event_hook("server-starting", load_enabled_hosts); | 52 eventmanager.add_event_hook("server-starting", load_enabled_hosts); |