namedotcom: get the actual registered domain so we can remove just that from the hostname to be created (#545)

This commit is contained in:
Sven Dowideit 2020-03-19 08:04:54 +10:00 committed by GitHub
parent fa19378184
commit 7bb614080b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -108,15 +108,20 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
fqdn, value := dns01.GetRecord(domain, keyAuth)
domainDetails, err := d.client.GetDomain(&namecom.GetDomainRequest{DomainName: domain})
if err != nil {
return fmt.Errorf("namedotcom API call failed: %v", err)
}
request := &namecom.Record{
DomainName: domain,
Host: d.extractRecordName(fqdn, domain),
Host: d.extractRecordName(fqdn, domainDetails.DomainName),
Type: "TXT",
TTL: uint32(d.config.TTL),
Answer: value,
}
_, err := d.client.CreateRecord(request)
_, err = d.client.CreateRecord(request)
if err != nil {
return fmt.Errorf("namedotcom: API call failed: %w", err)
}