Exemplo n.º 1
0
// NewDNSProviderCredentials uses the supplied credentials to return a
// DNSProvider instance configured for dnsimple.
func NewDNSProviderCredentials(email, key string) (*DNSProvider, error) {
	if email == "" || key == "" {
		return nil, fmt.Errorf("DNSimple credentials missing")
	}

	return &DNSProvider{
		client: dnsimple.NewClient(key, email),
	}, nil
}
Exemplo n.º 2
0
// NewDNSProviderDNSimple returns a DNSProviderDNSimple instance with a configured dnsimple client.
// Authentication is either done using the passed credentials or - when empty - using the environment
// variables DNSIMPLE_EMAIL and DNSIMPLE_API_KEY.
func NewDNSProviderDNSimple(dnsimpleEmail, dnsimpleApiKey string) (*DNSProviderDNSimple, error) {
	if dnsimpleEmail == "" || dnsimpleApiKey == "" {
		dnsimpleEmail, dnsimpleApiKey = dnsimpleEnvAuth()
		if dnsimpleEmail == "" || dnsimpleApiKey == "" {
			return nil, fmt.Errorf("DNSimple credentials missing")
		}
	}

	c := &DNSProviderDNSimple{
		client: dnsimple.NewClient(dnsimpleApiKey, dnsimpleEmail),
	}

	return c, nil
}