fix(netcup): allow wildcard domains (#863)

This commit is contained in:
Quentin McGaw
2024-11-20 06:38:22 -08:00
committed by GitHub
parent 56370f9ef2
commit 6c3490f5c5
2 changed files with 3 additions and 5 deletions

View File

@@ -26,7 +26,7 @@ Also keep in mind, that TTL, Expire, Retry and Refresh values of the given Domai
### Compulsory parameters
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`).
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`) or the wildcard `*.example.com`.
- `"api_key"` is your api key (generated in the [customercontrolpanel](https://www.customercontrolpanel.de))
- `"password"` is your api password (generated in the [customercontrolpanel](https://www.customercontrolpanel.de)). Netcup only allows one ApiPassword. This is not the account password. This password is used for all api keys.
- `"customer_number"` is your customer number (viewable in the [customercontrolpanel](https://www.customercontrolpanel.de) next to your name). As seen in the example above, provide the number as string value.

View File

@@ -38,7 +38,7 @@ func New(data json.RawMessage, domain, owner string,
return nil, fmt.Errorf("JSON decoding provider specific settings: %w", err)
}
err = validateSettings(domain, owner, extraSettings.CustomerNumber,
err = validateSettings(domain, extraSettings.CustomerNumber,
extraSettings.APIKey, extraSettings.Password)
if err != nil {
return nil, fmt.Errorf("validating provider specific settings: %w", err)
@@ -55,15 +55,13 @@ func New(data json.RawMessage, domain, owner string,
}, nil
}
func validateSettings(domain, owner, customerNumber, apiKey, password string) (err error) {
func validateSettings(domain, customerNumber, apiKey, password string) (err error) {
err = utils.CheckDomain(domain)
if err != nil {
return fmt.Errorf("%w: %w", errors.ErrDomainNotValid, err)
}
switch {
case owner == "*":
return fmt.Errorf("%w", errors.ErrOwnerWildcard)
case customerNumber == "":
return fmt.Errorf("%w", errors.ErrCustomerNumberNotSet)
case apiKey == "":