core/hostmanager.lua
changeset 5357 ac530c44772e
parent 5347 32e25358c3c2
child 5360 e44cfbf0ae8d
equal deleted inserted replaced
5354:18ebc3874364 5357:ac530c44772e
    35 local function load_enabled_hosts(config)
    35 local function load_enabled_hosts(config)
    36 	local defined_hosts = config or configmanager.getconfig();
    36 	local defined_hosts = config or configmanager.getconfig();
    37 	local activated_any_host;
    37 	local activated_any_host;
    38 	
    38 	
    39 	for host, host_config in pairs(defined_hosts) do
    39 	for host, host_config in pairs(defined_hosts) do
    40 		if host ~= "*" and host_config.core.enabled ~= false then
    40 		if host ~= "*" and host_config.enabled ~= false then
    41 			if not host_config.core.component_module then
    41 			if not host_config.component_module then
    42 				activated_any_host = true;
    42 				activated_any_host = true;
    43 			end
    43 			end
    44 			activate(host, host_config);
    44 			activate(host, host_config);
    45 		end
    45 		end
    46 	end
    46 	end
    76 		events = events_new();
    76 		events = events_new();
    77 		dialback_secret = configmanager.get(host, "core", "dialback_secret") or uuid_gen();
    77 		dialback_secret = configmanager.get(host, "core", "dialback_secret") or uuid_gen();
    78 		send = host_send;
    78 		send = host_send;
    79 		modules = {};
    79 		modules = {};
    80 	};
    80 	};
    81 	if not host_config.core.component_module then -- host
    81 	if not host_config.component_module then -- host
    82 		host_session.type = "local";
    82 		host_session.type = "local";
    83 		host_session.sessions = {};
    83 		host_session.sessions = {};
    84 	else -- component
    84 	else -- component
    85 		host_session.type = "component";
    85 		host_session.type = "component";
    86 	end
    86 	end
    87 	hosts[host] = host_session;
    87 	hosts[host] = host_session;
    88 	if not host:match("[@/]") then
    88 	if not host:match("[@/]") then
    89 		disco_items:set(host:match("%.(.*)") or "*", host, host_config.core.name or true);
    89 		disco_items:set(host:match("%.(.*)") or "*", host, host_config.name or true);
    90 	end
    90 	end
    91 	for option_name in pairs(host_config.core) do
    91 	for option_name in pairs(host_config) do
    92 		if option_name:match("_ports$") or option_name:match("_interface$") then
    92 		if option_name:match("_ports$") or option_name:match("_interface$") then
    93 			log("warn", "%s: Option '%s' has no effect for virtual hosts - put it in the server-wide section instead", host, option_name);
    93 			log("warn", "%s: Option '%s' has no effect for virtual hosts - put it in the server-wide section instead", host, option_name);
    94 		end
    94 		end
    95 	end
    95 	end
    96 	
    96