Diff

prosodyctl @ 5547:f306daf2bf6d

prosodyctl: Guess the country from the TLD for the cert config
author Kim Alvefur <zash@zash.se>
date Mon, 29 Apr 2013 14:01:19 +0200
parent 5546:edc97af48d19
child 5554:e91db0aac408
child 6035:1b5ca55bf895
line wrap: on
line diff
--- 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;