Comparison

plugins/mod_admin_shell.lua @ 11604:7466bf65d7c8

mod_admin_shell: module:info: Use existing host string representation Hosts have a metatable __tostring method that produces a nice representation such as `VirtualHost "example.com"`, which even includes the component module for internal components.
author Kim Alvefur <zash@zash.se>
date Sat, 12 Jun 2021 16:47:30 +0200
parent 11603:4e24408a3f57
child 11605:225ef07f2bee
comparison
equal deleted inserted replaced
11603:4e24408a3f57 11604:7466bf65d7c8
405 405
406 for host in hosts do 406 for host in hosts do
407 local mod = modulemanager.get_module(host, name); 407 local mod = modulemanager.get_module(host, name);
408 if mod.module.host == "*" then 408 if mod.module.host == "*" then
409 print("in global context"); 409 print("in global context");
410 elseif mod.module:get_host_type() == "local" then 410 else
411 print("on VirtualHost " .. mod.module.host); 411 print("on " .. tostring(prosody.hosts[mod.module.host]));
412 elseif mod.module:get_host_type() == "component" then
413 local component_type = module:context(host):get_option_string("component_module", type);
414 if component_type == "component" then
415 component_type = "external";
416 end
417 print("on " .. component_type .. " Component " .. mod.module.host);
418 end 412 end
419 print(" path: " .. (mod.module.path or "n/a")); 413 print(" path: " .. (mod.module.path or "n/a"));
420 if mod.module.status_message then 414 if mod.module.status_message then
421 print(" status: [" .. mod.module.status_type .. "] " .. mod.module.status_message); 415 print(" status: [" .. mod.module.status_type .. "] " .. mod.module.status_message);
422 end 416 end