1
0
Fork 0

DNS challenge Cloudflare auth zone

This commit is contained in:
Ludovic Fernandez 2018-10-15 09:40:02 +02:00 committed by Traefiker Bot
parent 0335f6fba9
commit 7c2409b5a7
18 changed files with 312 additions and 248 deletions

View file

@ -89,13 +89,17 @@ type ChangeInfo struct {
}
// NewClient Creates a new client of NIFCLOUD DNS
func NewClient(accessKey string, secretKey string) *Client {
func NewClient(accessKey string, secretKey string) (*Client, error) {
if len(accessKey) == 0 || len(secretKey) == 0 {
return nil, errors.New("credentials missing")
}
return &Client{
accessKey: accessKey,
secretKey: secretKey,
BaseURL: defaultBaseURL,
HTTPClient: &http.Client{},
}
}, nil
}
// Client client of NIFCLOUD DNS

View file

@ -77,7 +77,10 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
return nil, errors.New("nifcloud: the configuration of the DNS provider is nil")
}
client := NewClient(config.AccessKey, config.SecretKey)
client, err := NewClient(config.AccessKey, config.SecretKey)
if err != nil {
return nil, fmt.Errorf("nifcloud: %v", err)
}
if config.HTTPClient != nil {
client.HTTPClient = config.HTTPClient