Software /
code /
prosody
Comparison
plugins/mod_admin_shell.lua @ 13823:e78e79f1b5f5 13.0 13.0.1
mod_admin_shell: Visual tweaks to the output of debug:cert_index()
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 03 Apr 2025 19:58:57 +0100 |
parent | 13819:3ee95eb17045 |
child | 13828:a071b20ccc0f |
comparison
equal
deleted
inserted
replaced
13822:b88f94aecfe3 | 13823:e78e79f1b5f5 |
---|---|
2408 | 2408 |
2409 path = path or module:get_option("certificates", "certs"); | 2409 path = path or module:get_option("certificates", "certs"); |
2410 | 2410 |
2411 local sink = logger.add_simple_sink(function (source, level, message) | 2411 local sink = logger.add_simple_sink(function (source, level, message) |
2412 if source == "certmanager" then | 2412 if source == "certmanager" then |
2413 self.session.print(source, level, message); | 2413 if level == "debug" or level == "info" then |
2414 level = "II"; | |
2415 elseif level == "warn" or level == "error" then | |
2416 level = "EE"; | |
2417 end | |
2418 self.session.print(level..": "..message); | |
2414 end | 2419 end |
2415 end); | 2420 end); |
2421 | |
2422 print("II: Scanning "..path.."..."); | |
2416 | 2423 |
2417 local index = {}; | 2424 local index = {}; |
2418 cm.index_certs(path, index) | 2425 cm.index_certs(path, index) |
2419 | 2426 |
2420 if not logger.remove_sink(sink) then | 2427 if not logger.remove_sink(sink) then |
2434 { title = "Domain", width = max_domain }; | 2441 { title = "Domain", width = max_domain }; |
2435 { title = "Certificate", width = "100%" }; | 2442 { title = "Certificate", width = "100%" }; |
2436 { title = "Service", width = 5 }; | 2443 { title = "Service", width = 5 }; |
2437 }, self.session.width); | 2444 }, self.session.width); |
2438 print(row()); | 2445 print(row()); |
2439 | 2446 print(("-"):rep(self.session.width or 80)); |
2440 for domain, certs in it.sorted_pairs(index) do | 2447 for domain, certs in it.sorted_pairs(index) do |
2441 for cert_file, services in it.sorted_pairs(certs) do | 2448 for cert_file, services in it.sorted_pairs(certs) do |
2442 for service in it.sorted_pairs(services) do | 2449 for service in it.sorted_pairs(services) do |
2443 c = c + 1; | 2450 c = c + 1; |
2444 print(row({ domain, cert_file, service })); | 2451 print(row({ domain, cert_file, service })); |