Skip to content

Commit

Permalink
Add trailing dot to cnames
Browse files Browse the repository at this point in the history
This makes the behavior consistent between NS, MX, SRV and CNAME records
  • Loading branch information
peterablehmann committed May 5, 2024
1 parent a47a6a7 commit 5b6f629
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
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

0 comments on commit 5b6f629

Please sign in to comment.