Skip to content

Commit

Permalink
Merge pull request #15 from peterablehmann/fix-cnames
Browse files Browse the repository at this point in the history
Add trailing dot to cnames
  • Loading branch information
Janik-Haag authored May 10, 2024
2 parents a47a6a7 + d80c9de commit c4f734d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 2024-05-06
If you use CNAMEs a trailing dot will now be added automatically.
This behavior is in line with other record types that use dns names.

This breaks using subdomain paths in CNAMEs and if you are using full domain names
in CNAMEs you will need to remove the trailing dot in your config.

`zones."example.org"."example".cname.data = "example2"`-> `example.example.org IN CNAME example2.`
You will now have to write it as:
`zones."example.org"."example".cname.data = "example2.example.org"`-> `example.example.org IN CNAME example2.example.org.`
2 changes: 1 addition & 1 deletion modules/records.nix
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ lib.mapAttrs
'';
example = "foo.example.com";
type = with lib.types; nullOr str; # change str to lib.types.domain once it exists
apply = x: if x != null then lib.toList x else x;
apply = x: if x != null then lib.toList "${x}." else x;
};
sub = {
apply = lib.toList;
Expand Down
2 changes: 1 addition & 1 deletion utils/tests/debug.nix
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ in
"example.org" = {
"example.org" = {
cname = {
data = [ "www.example.com" ];
data = [ "www.example.com." ];
ttl = 60;
};
};
Expand Down
2 changes: 1 addition & 1 deletion utils/tests/domains.nix
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
"example.org" = {
"example.org" = {
cname = {
data = [ "www.example.com" ];
data = [ "www.example.com." ];
ttl = 60;
};
};
Expand Down

0 comments on commit c4f734d

Please sign in to comment.