Diff

core/hostmanager.lua @ 6721:3807af36d773

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Tue, 19 May 2015 16:33:47 +0200
parent 6621:352fa2cae1c9
parent 6706:60c692828cf6
child 6791:e813e8cf6046
line wrap: on
line diff
--- a/core/hostmanager.lua	Fri May 15 15:33:31 2015 +0200
+++ b/core/hostmanager.lua	Tue May 19 16:33:47 2015 +0200
@@ -26,9 +26,23 @@
 
 local pairs, select, rawget = pairs, select, rawget;
 local tostring, type = tostring, type;
+local setmetatable = setmetatable;
 
 module "hostmanager"
 
+local host_mt = { }
+function host_mt:__tostring()
+	if self.type == "component" then
+		local typ = configmanager.get(self.host, "component_module");
+		if typ == "component" then
+			return ("Component %q"):format(self.host);
+		end
+		return ("Component %q %q"):format(self.host, typ);
+	elseif self.type == "local" then
+		return ("VirtualHost %q"):format(self.host);
+	end
+end
+
 local hosts_loaded_once;
 
 local function load_enabled_hosts(config)
@@ -69,6 +83,7 @@
 		send = host_send;
 		modules = {};
 	};
+	setmetatable(host_session, host_mt);
 	if not host_config.component_module then -- host
 		host_session.type = "local";
 		host_session.sessions = {};