Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
5546:edc97af48d19 | 5547:f306daf2bf6d |
---|---|
668 local nv; | 668 local nv; |
669 if k == "commonName" then | 669 if k == "commonName" then |
670 v = arg[1] | 670 v = arg[1] |
671 elseif k == "emailAddress" then | 671 elseif k == "emailAddress" then |
672 v = "xmpp@" .. arg[1]; | 672 v = "xmpp@" .. arg[1]; |
673 elseif k == "countryName" then | |
674 local tld = arg[1]:match"%.([a-z]+)$"; | |
675 if tld and #tld == 2 and tld ~= "uk" then | |
676 v = tld:upper(); | |
677 end | |
673 end | 678 end |
674 nv = show_prompt(("%s (%s):"):format(k, nv or v)); | 679 nv = show_prompt(("%s (%s):"):format(k, nv or v)); |
675 nv = (not nv or nv == "") and v or nv; | 680 nv = (not nv or nv == "") and v or nv; |
676 if nv:find"[\192-\252][\128-\191]+" then | 681 if nv:find"[\192-\252][\128-\191]+" then |
677 conf.req.string_mask = "utf8only" | 682 conf.req.string_mask = "utf8only" |