mirror of
				https://github.com/go-acme/lego.git
				synced 2025-10-31 08:27:38 +02:00 
			
		
		
		
	ibmcloud: add support for subdomains (#1779)
Co-authored-by: Ludovic Fernandez <ldez@users.noreply.github.com>
This commit is contained in:
		| @@ -2,6 +2,7 @@ package internal | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/softlayer/softlayer-go/datatypes" | ||||
| 	"github.com/softlayer/softlayer-go/services" | ||||
| @@ -66,7 +67,16 @@ func getDomainID(service services.Dns_Domain, domain string) (*int, error) { | ||||
| 		return r.Id, nil | ||||
| 	} | ||||
|  | ||||
| 	return nil, fmt.Errorf("no data found of domain: %s", domain) | ||||
| 	// The domain was not found by name. | ||||
| 	// For subdomains this is not unusual in softlayer. | ||||
| 	// So in case a subdomain like `sub.toplevel.tld` was used try again using the parent domain | ||||
| 	// (strip the first part in the domain string -> `toplevel.tld`). | ||||
| 	_, parent, found := strings.Cut(domain, ".") | ||||
| 	if !found || !strings.Contains(parent, ".") { | ||||
| 		return nil, fmt.Errorf("no data found for domain: %s", domain) | ||||
| 	} | ||||
|  | ||||
| 	return getDomainID(service, parent) | ||||
| } | ||||
|  | ||||
| func findTxtRecords(service services.Dns_Domain, fqdn string) ([]datatypes.Dns_Domain_ResourceRecord, error) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user