Try specifying the characters

This commit is contained in:
niten 2023-10-07 10:00:18 -07:00
parent 071866cbd6
commit fed7baa20e
1 changed files with 7 additions and 5 deletions

View File

@ -57,12 +57,14 @@ let
isNotNull = o: !isNull o;
hostToFqdn = host:
if isNotNull (builtins.match "[^.]+\\.$" host) then
host
else if isNotNull (builtins.match "([^.]+\\.)+[^.]+$" host) then
"${host}."
else if (hasAttr host zone.hosts) then
let hostChars = "[a-zA-Z0-9_-]";
in if (hasAttr host zone.hosts) then
"${host}.${domain}."
else if isNotNull (builtins.match "${hostChars}+\\.$" host) then
host
else if isNotNull
(builtins.match "(${hostChars}+\\.)+${hostChars}+$" host) then
"${host}."
else
abort "unrecognized hostname: ${host}";