From 85b5ef459a9c78d0c9d9a8150bbaad130c7ebfbc Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Fri, 4 Oct 2024 23:18:51 +0200 Subject: [PATCH] selectelv2: use baseURL from configuration (#2291) --- providers/dns/selectelv2/selectelv2.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/providers/dns/selectelv2/selectelv2.go b/providers/dns/selectelv2/selectelv2.go index a6f1d730..4cc6e941 100644 --- a/providers/dns/selectelv2/selectelv2.go +++ b/providers/dns/selectelv2/selectelv2.go @@ -11,7 +11,6 @@ import ( "github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/platform/config/env" - "github.com/go-acme/lego/v4/providers/dns/internal/selectel" selectelapi "github.com/selectel/domains-go/pkg/v2" "github.com/selectel/go-selvpcclient/v3/selvpcclient" ) @@ -26,6 +25,8 @@ const ( defaultHTTPTimeout = 30 * time.Second ) +const defaultUserAgent = "go-acme/lego" + const ( envNamespace = "SELECTELV2_" @@ -59,7 +60,7 @@ type Config struct { // NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ - BaseURL: env.GetOrDefaultString(EnvBaseURL, selectel.DefaultSelectelBaseURL), + BaseURL: env.GetOrDefaultString(EnvBaseURL, defaultBaseURL), TTL: env.GetOrDefaultInt(EnvTTL, defaultTTL), PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, defaultPropagationTimeout), PollingInterval: env.GetOrDefaultSecond(EnvPollingInterval, defaultPollingInterval), @@ -113,10 +114,10 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { } headers := http.Header{} - headers.Set("User-Agent", "lego/selectelv2") + headers.Set("User-Agent", defaultUserAgent) return &DNSProvider{ - baseClient: selectelapi.NewClient(defaultBaseURL, config.HTTPClient, headers), + baseClient: selectelapi.NewClient(config.BaseURL, config.HTTPClient, headers), config: config, }, nil }