prosodyctl: Guess the country from the TLD for the cert config
authorKim Alvefur <zash@zash.se>
Mon, 29 Apr 2013 14:01:19 +0200
changeset 5547 f306daf2bf6d
parent 5546 edc97af48d19
child 5548 c5d1c35c93f4
prosodyctl: Guess the country from the TLD for the cert config
prosodyctl
--- a/prosodyctl	Mon Apr 29 14:00:44 2013 +0200
+++ b/prosodyctl	Mon Apr 29 14:01:19 2013 +0200
@@ -670,6 +670,11 @@
 					v = arg[1]
 				elseif k == "emailAddress" then
 					v = "xmpp@" .. arg[1];
+				elseif k == "countryName" then
+					local tld = arg[1]:match"%.([a-z]+)$";
+					if tld and #tld == 2 and tld ~= "uk" then
+						v = tld:upper();
+					end
 				end
 				nv = show_prompt(("%s (%s):"):format(k, nv or v));
 				nv = (not nv or nv == "") and v or nv;