Software / code / prosody
Comparison
core/hostmanager.lua @ 2855:66a1aa0bedc0
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 | 1980:8fceabd84d74 |
| child | 2877:1edeb8fe7d14 |
comparison
equal
deleted
inserted
replaced
| 2854:ce8ce431c2b8 | 2855:66a1aa0bedc0 |
|---|---|
| 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); |