Skip to content

Commit 94362c6

Browse files
SMHRamboldez
authored andcommitted
dynu: fix subdomain support (#1842)
Co-authored-by: Fernandez Ludovic <[email protected]>
1 parent 6c6ede2 commit 94362c6

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

providers/dns/dynu/dynu.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) {
9797
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
9898
fqdn, value := dns01.GetRecord(domain, keyAuth)
9999

100-
// TODO(ldez) replace domain by FQDN to follow CNAME.
101-
rootDomain, err := d.client.GetRootDomain(domain)
100+
rootDomain, err := d.client.GetRootDomain(dns01.UnFqdn(fqdn))
102101
if err != nil {
103102
return fmt.Errorf("dynu: could not find root domain for %s: %w", domain, err)
104103
}
@@ -115,7 +114,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
115114
}
116115
}
117116

118-
subDomain, err := dns01.ExtractSubDomain(fqdn, domain)
117+
subDomain, err := dns01.ExtractSubDomain(fqdn, rootDomain.DomainName)
119118
if err != nil {
120119
return fmt.Errorf("dynu: %w", err)
121120
}
@@ -142,8 +141,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
142141
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
143142
fqdn, value := dns01.GetRecord(domain, keyAuth)
144143

145-
// TODO(ldez) replace domain by FQDN to follow CNAME.
146-
rootDomain, err := d.client.GetRootDomain(domain)
144+
rootDomain, err := d.client.GetRootDomain(dns01.UnFqdn(fqdn))
147145
if err != nil {
148146
return fmt.Errorf("dynu: could not find root domain for %s: %w", domain, err)
149147
}

0 commit comments

Comments
 (0)