dnsimple: add debug option (#1630)

This commit is contained in:
Matt Sporleder 2022-04-25 18:08:38 -04:00 committed by GitHub
parent 6b8d5a0afc
commit e83220c1c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,6 +21,7 @@ const (
EnvOAuthToken = envNamespace + "OAUTH_TOKEN"
EnvBaseURL = envNamespace + "BASE_URL"
EnvDebug = envNamespace + "DEBUG"
EnvTTL = envNamespace + "TTL"
EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT"
@ -29,6 +30,7 @@ const (
// Config is used to configure the creation of the DNSProvider.
type Config struct {
Debug bool
AccessToken string
BaseURL string
PropagationTimeout time.Duration
@ -40,6 +42,7 @@ type Config struct {
func NewDefaultConfig() *Config {
return &Config{
TTL: env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL),
Debug: env.GetOrDefaultBool(EnvDebug, false),
PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, dns01.DefaultPropagationTimeout),
PollingInterval: env.GetOrDefaultSecond(EnvPollingInterval, dns01.DefaultPollingInterval),
}
@ -81,6 +84,8 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
client.BaseURL = config.BaseURL
}
client.Debug = config.Debug
return &DNSProvider{client: client, config: config}, nil
}