Changeset

8249:cc664a3917e2

prosodyctl: cert import: Use env variable set by certbot if invoked as post-renew hook
author Kim Alvefur <zash@zash.se>
date Mon, 18 Sep 2017 18:28:29 +0200
parents 8248:259e0010a6d4
children 8250:9ea5ea53744b
files prosodyctl
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/prosodyctl	Mon Sep 18 17:08:31 2017 +0200
+++ b/prosodyctl	Mon Sep 18 18:28:29 2017 +0200
@@ -871,10 +871,17 @@
 		table.insert(hostnames, table.remove(arg, 1));
 	end
 	if hostnames[1] == nil then
-		for host in pairs(prosody.hosts) do
-			if host ~= "*" and config.get(host, "enabled") ~= false then
+		local domains = os.getenv"RENEWED_DOMAINS"; -- Set if invoked via certbot
+		if domains then
+			for host in domains:gmatch("%S+") do
 				table.insert(hostnames, host);
 			end
+		else
+			for host in pairs(prosody.hosts) do
+				if host ~= "*" and config.get(host, "enabled") ~= false then
+					table.insert(hostnames, host);
+				end
+			end
 		end
 	end
 	if not arg[1] or arg[1] == "--help" then -- Probably forgot the path