dynu: fix subdomain support (#1842)

Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
This commit is contained in:
Sascha Marcel Hacker 2023-02-20 00:59:17 +01:00 committed by GitHub
parent 532788d42a
commit 1e2793f9ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)
}
@ -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)
}
@ -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)
}