mirror of
https://github.com/go-acme/lego
synced 2026-03-14 14:35:48 +01:00
azure: reinforces deprecation (#2792)
This commit is contained in:
parent
527d51d485
commit
d063b15c02
2 changed files with 23 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ import (
|
|||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
|
|
@ -37,6 +38,8 @@ const (
|
|||
EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
|
||||
)
|
||||
|
||||
const EnvLegoAzureBypassDeprecation = "LEGO_AZURE_BYPASS_DEPRECATION"
|
||||
|
||||
const defaultMetadataEndpoint = "http://169.254.169.254"
|
||||
|
||||
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
|
||||
|
|
@ -133,6 +136,18 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
|
|||
return nil, errors.New("azure: the configuration of the DNS provider is nil")
|
||||
}
|
||||
|
||||
if !env.GetOrDefaultBool(EnvLegoAzureBypassDeprecation, false) {
|
||||
var msg strings.Builder
|
||||
|
||||
msg.WriteString("azure: ")
|
||||
msg.WriteString("The `azure` provider has been deprecated since 2023, and replaced by `azuredns` provider. ")
|
||||
msg.WriteString("It can be TEMPORARILY reactivated by using the environment variable `LEGO_AZURE_BYPASS_DEPRECATION=true`. ")
|
||||
msg.WriteString("The `azure` provider will be removed in a future release, please migrate to the `azuredns` provider. ")
|
||||
msg.WriteString("The documentation of the `azuredns` provider can be found at https://go-acme.github.io/lego/dns/azuredns/")
|
||||
|
||||
return nil, errors.New(msg.String())
|
||||
}
|
||||
|
||||
if config.HTTPClient == nil {
|
||||
config.HTTPClient = &http.Client{Timeout: 5 * time.Second}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import (
|
|||
const envDomain = envNamespace + "DOMAIN"
|
||||
|
||||
var envTest = tester.NewEnvTest(
|
||||
EnvLegoAzureBypassDeprecation,
|
||||
EnvEnvironment,
|
||||
EnvClientID,
|
||||
EnvClientSecret,
|
||||
|
|
@ -57,6 +58,8 @@ func TestNewDNSProvider(t *testing.T) {
|
|||
|
||||
envTest.ClearEnv()
|
||||
|
||||
test.envVars[EnvLegoAzureBypassDeprecation] = "true"
|
||||
|
||||
envTest.Apply(test.envVars)
|
||||
|
||||
p, err := NewDNSProvider()
|
||||
|
|
@ -140,6 +143,11 @@ func TestNewDNSProviderConfig(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
defer envTest.RestoreEnv()
|
||||
|
||||
envTest.ClearEnv()
|
||||
envTest.Apply(map[string]string{EnvLegoAzureBypassDeprecation: "true"})
|
||||
|
||||
for _, test := range testCases {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
config := NewDefaultConfig()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue