Skip to content

Commit

Permalink
dynu: fix subdomain support (#1842)
Browse files Browse the repository at this point in the history
Co-authored-by: Fernandez Ludovic <[email protected]>
  • Loading branch information
SMHRambo and ldez committed Feb 19, 2023
1 parent 532788d commit 1e2793f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions providers/dns/dynu/dynu.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) {
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
fqdn, value := dns01.GetRecord(domain, keyAuth)

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

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

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

0 comments on commit 1e2793f

Please sign in to comment.