Skip to content

Commit

Permalink
fix(netcup): allow wildcard domains (#863)
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 authored Nov 20, 2024
1 parent 56370f9 commit 6c3490f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/netcup.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 2 additions & 4 deletions internal/provider/providers/netcup/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 == "":
Expand Down

0 comments on commit 6c3490f

Please sign in to comment.