Skip to content

Commit c4f734d

Browse files
authored
Merge pull request #15 from peterablehmann/fix-cnames
Add trailing dot to cnames
2 parents a47a6a7 + d80c9de commit c4f734d

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# 2024-05-06
2+
If you use CNAMEs a trailing dot will now be added automatically.
3+
This behavior is in line with other record types that use dns names.
4+
5+
This breaks using subdomain paths in CNAMEs and if you are using full domain names
6+
in CNAMEs you will need to remove the trailing dot in your config.
7+
8+
`zones."example.org"."example".cname.data = "example2"`-> `example.example.org IN CNAME example2.`
9+
You will now have to write it as:
10+
`zones."example.org"."example".cname.data = "example2.example.org"`-> `example.example.org IN CNAME example2.example.org.`

modules/records.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ lib.mapAttrs
8484
'';
8585
example = "foo.example.com";
8686
type = with lib.types; nullOr str; # change str to lib.types.domain once it exists
87-
apply = x: if x != null then lib.toList x else x;
87+
apply = x: if x != null then lib.toList "${x}." else x;
8888
};
8989
sub = {
9090
apply = lib.toList;

utils/tests/debug.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ in
9898
"example.org" = {
9999
"example.org" = {
100100
cname = {
101-
data = [ "www.example.com" ];
101+
data = [ "www.example.com." ];
102102
ttl = 60;
103103
};
104104
};

utils/tests/domains.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@
276276
"example.org" = {
277277
"example.org" = {
278278
cname = {
279-
data = [ "www.example.com" ];
279+
data = [ "www.example.com." ];
280280
ttl = 60;
281281
};
282282
};

0 commit comments

Comments
 (0)