Skip to content

Commit

Permalink
selectelv2: use baseURL from configuration (#2291)
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez authored Oct 4, 2024
1 parent 6e2e6d2 commit 85b5ef4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions providers/dns/selectelv2/selectelv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -26,6 +25,8 @@ const (
defaultHTTPTimeout = 30 * time.Second
)

const defaultUserAgent = "go-acme/lego"

const (
envNamespace = "SELECTELV2_"

Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 85b5ef4

Please sign in to comment.