mirror of
				https://github.com/go-acme/lego.git
				synced 2025-10-31 08:27:38 +02:00 
			
		
		
		
	webnames: rename to webnamesru to avoid ambiguity with webnamesca (#2700)
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							7d099f2ad7
						
					
				
				
					commit
					591116b3a4
				
			| @@ -252,9 +252,9 @@ Detailed documentation is available [here](https://go-acme.github.io/lego/dns). | ||||
|   <td><a href="https://go-acme.github.io/lego/dns/volcengine/">Volcano Engine/火山引擎</a></td> | ||||
|   <td><a href="https://go-acme.github.io/lego/dns/vscale/">Vscale</a></td> | ||||
|   <td><a href="https://go-acme.github.io/lego/dns/vultr/">Vultr</a></td> | ||||
|   <td><a href="https://go-acme.github.io/lego/dns/webnames/">Webnames</a></td> | ||||
| </tr><tr> | ||||
|   <td><a href="https://go-acme.github.io/lego/dns/webnamesca/">webnames.ca</a></td> | ||||
| </tr><tr> | ||||
|   <td><a href="https://go-acme.github.io/lego/dns/webnames/">webnames.ru</a></td> | ||||
|   <td><a href="https://go-acme.github.io/lego/dns/websupport/">Websupport</a></td> | ||||
|   <td><a href="https://go-acme.github.io/lego/dns/wedos/">WEDOS</a></td> | ||||
|   <td><a href="https://go-acme.github.io/lego/dns/westcn/">West.cn/西部数码</a></td> | ||||
|   | ||||
							
								
								
									
										10
									
								
								cmd/zz_gen_cmd_dnshelp.go
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										10
									
								
								cmd/zz_gen_cmd_dnshelp.go
									
									
									
										generated
									
									
									
								
							| @@ -3514,19 +3514,19 @@ func displayDNSHelp(w io.Writer, name string) error { | ||||
|  | ||||
| 	case "webnames": | ||||
| 		// generated from: providers/dns/webnames/webnames.toml | ||||
| 		ew.writeln(`Configuration for Webnames.`) | ||||
| 		ew.writeln(`Configuration for webnames.ru.`) | ||||
| 		ew.writeln(`Code:	'webnames'`) | ||||
| 		ew.writeln(`Since:	'v4.15.0'`) | ||||
| 		ew.writeln() | ||||
|  | ||||
| 		ew.writeln(`Credentials:`) | ||||
| 		ew.writeln(`	- "WEBNAMES_API_KEY":	Domain API key`) | ||||
| 		ew.writeln(`	- "WEBNAMESRU_API_KEY":	Domain API key`) | ||||
| 		ew.writeln() | ||||
|  | ||||
| 		ew.writeln(`Additional Configuration:`) | ||||
| 		ew.writeln(`	- "WEBNAMES_HTTP_TIMEOUT":	API request timeout in seconds (Default: 30)`) | ||||
| 		ew.writeln(`	- "WEBNAMES_POLLING_INTERVAL":	Time between DNS propagation check in seconds (Default: 2)`) | ||||
| 		ew.writeln(`	- "WEBNAMES_PROPAGATION_TIMEOUT":	Maximum waiting time for DNS propagation in seconds (Default: 60)`) | ||||
| 		ew.writeln(`	- "WEBNAMESRU_HTTP_TIMEOUT":	API request timeout in seconds (Default: 30)`) | ||||
| 		ew.writeln(`	- "WEBNAMESRU_POLLING_INTERVAL":	Time between DNS propagation check in seconds (Default: 2)`) | ||||
| 		ew.writeln(`	- "WEBNAMESRU_PROPAGATION_TIMEOUT":	Maximum waiting time for DNS propagation in seconds (Default: 60)`) | ||||
|  | ||||
| 		ew.writeln() | ||||
| 		ew.writeln(`More information: https://go-acme.github.io/lego/dns/webnames`) | ||||
|   | ||||
							
								
								
									
										18
									
								
								docs/content/dns/zz_gen_webnames.md
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										18
									
								
								docs/content/dns/zz_gen_webnames.md
									
									
									
										generated
									
									
									
								
							| @@ -1,5 +1,5 @@ | ||||
| --- | ||||
| title: "Webnames" | ||||
| title: "webnames.ru" | ||||
| date: 2019-03-03T16:39:46+01:00 | ||||
| draft: false | ||||
| slug: webnames | ||||
| @@ -14,7 +14,7 @@ dnsprovider: | ||||
| <!-- THIS DOCUMENTATION IS AUTO-GENERATED. PLEASE DO NOT EDIT. --> | ||||
|  | ||||
|  | ||||
| Configuration for [Webnames](https://www.webnames.ru/). | ||||
| Configuration for [webnames.ru](https://www.webnames.ru/). | ||||
|  | ||||
|  | ||||
| <!--more--> | ||||
| @@ -23,11 +23,11 @@ Configuration for [Webnames](https://www.webnames.ru/). | ||||
| - Since: v4.15.0 | ||||
|  | ||||
|  | ||||
| Here is an example bash command using the Webnames provider: | ||||
| Here is an example bash command using the webnames.ru provider: | ||||
|  | ||||
| ```bash | ||||
| WEBNAMES_API_KEY=xxxxxx \ | ||||
| lego --email you@example.com --dns webnames -d '*.example.com' -d example.com run | ||||
| WEBNAMESRU_API_KEY=xxxxxx \ | ||||
| lego --email you@example.com --dns webnamesru -d '*.example.com' -d example.com run | ||||
| ``` | ||||
|  | ||||
|  | ||||
| @@ -37,7 +37,7 @@ lego --email you@example.com --dns webnames -d '*.example.com' -d example.com ru | ||||
|  | ||||
| | Environment Variable Name | Description | | ||||
| |-----------------------|-------------| | ||||
| | `WEBNAMES_API_KEY` | Domain API key | | ||||
| | `WEBNAMESRU_API_KEY` | Domain API key | | ||||
|  | ||||
| The environment variable names can be suffixed by `_FILE` to reference a file instead of a value. | ||||
| More information [here]({{% ref "dns#configuration-and-credentials" %}}). | ||||
| @@ -47,9 +47,9 @@ More information [here]({{% ref "dns#configuration-and-credentials" %}}). | ||||
|  | ||||
| | Environment Variable Name | Description | | ||||
| |--------------------------------|-------------| | ||||
| | `WEBNAMES_HTTP_TIMEOUT` | API request timeout in seconds (Default: 30) | | ||||
| | `WEBNAMES_POLLING_INTERVAL` | Time between DNS propagation check in seconds (Default: 2) | | ||||
| | `WEBNAMES_PROPAGATION_TIMEOUT` | Maximum waiting time for DNS propagation in seconds (Default: 60) | | ||||
| | `WEBNAMESRU_HTTP_TIMEOUT` | API request timeout in seconds (Default: 30) | | ||||
| | `WEBNAMESRU_POLLING_INTERVAL` | Time between DNS propagation check in seconds (Default: 2) | | ||||
| | `WEBNAMESRU_PROPAGATION_TIMEOUT` | Maximum waiting time for DNS propagation in seconds (Default: 60) | | ||||
|  | ||||
| The environment variable names can be suffixed by `_FILE` to reference a file instead of a value. | ||||
| More information [here]({{% ref "dns#configuration-and-credentials" %}}). | ||||
|   | ||||
| @@ -6,6 +6,7 @@ import ( | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"net/http" | ||||
| 	"strings" | ||||
| 	"time" | ||||
|  | ||||
| 	"github.com/go-acme/lego/v4/challenge" | ||||
| @@ -17,7 +18,8 @@ import ( | ||||
|  | ||||
| // Environment variables names. | ||||
| const ( | ||||
| 	envNamespace = "WEBNAMES_" | ||||
| 	envNamespace    = "WEBNAMESRU_" | ||||
| 	altEnvNamespace = "WEBNAMES_" | ||||
|  | ||||
| 	EnvAPIKey = envNamespace + "API_KEY" | ||||
|  | ||||
| @@ -40,10 +42,10 @@ type Config struct { | ||||
| // NewDefaultConfig returns a default configuration for the DNSProvider. | ||||
| func NewDefaultConfig() *Config { | ||||
| 	return &Config{ | ||||
| 		PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, dns01.DefaultPropagationTimeout), | ||||
| 		PollingInterval:    env.GetOrDefaultSecond(EnvPollingInterval, dns01.DefaultPollingInterval), | ||||
| 		PropagationTimeout: env.GetOneWithFallback(EnvPropagationTimeout, dns01.DefaultPropagationTimeout, env.ParseSecond, altEnvName(EnvPropagationTimeout)), | ||||
| 		PollingInterval:    env.GetOneWithFallback(EnvPollingInterval, dns01.DefaultPollingInterval, env.ParseSecond, altEnvName(EnvPollingInterval)), | ||||
| 		HTTPClient: &http.Client{ | ||||
| 			Timeout: env.GetOrDefaultSecond(EnvHTTPTimeout, 30*time.Second), | ||||
| 			Timeout: env.GetOneWithFallback(EnvHTTPTimeout, 20*time.Second, env.ParseSecond, altEnvName(EnvHTTPTimeout)), | ||||
| 		}, | ||||
| 	} | ||||
| } | ||||
| @@ -55,11 +57,11 @@ type DNSProvider struct { | ||||
| } | ||||
|  | ||||
| // NewDNSProvider returns a new DNS provider using | ||||
| // environment variable WEBNAMES_API_KEY for adding and removing the DNS record. | ||||
| // environment variable WEBNAMESRU_API_KEY for adding and removing the DNS record. | ||||
| func NewDNSProvider() (*DNSProvider, error) { | ||||
| 	values, err := env.Get(EnvAPIKey) | ||||
| 	values, err := env.GetWithFallback([]string{EnvAPIKey, altEnvName(EnvAPIKey)}) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("webnames: %w", err) | ||||
| 		return nil, fmt.Errorf("webnamesru: %w", err) | ||||
| 	} | ||||
|  | ||||
| 	config := NewDefaultConfig() | ||||
| @@ -71,11 +73,11 @@ func NewDNSProvider() (*DNSProvider, error) { | ||||
| // NewDNSProviderConfig return a DNSProvider instance configured for Webnames. | ||||
| func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { | ||||
| 	if config == nil { | ||||
| 		return nil, errors.New("webnames: the configuration of the DNS provider is nil") | ||||
| 		return nil, errors.New("webnamesru: the configuration of the DNS provider is nil") | ||||
| 	} | ||||
|  | ||||
| 	if config.APIKey == "" { | ||||
| 		return nil, errors.New("webnames: credentials missing") | ||||
| 		return nil, errors.New("webnamesru: credentials missing") | ||||
| 	} | ||||
|  | ||||
| 	client := internal.NewClient(config.APIKey) | ||||
| @@ -95,17 +97,17 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { | ||||
|  | ||||
| 	authZone, err := dns01.FindZoneByFqdn(info.EffectiveFQDN) | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("webnames: could not find zone for domain %q: %w", domain, err) | ||||
| 		return fmt.Errorf("webnamesru: could not find zone for domain %q: %w", domain, err) | ||||
| 	} | ||||
|  | ||||
| 	subDomain, err := dns01.ExtractSubDomain(info.EffectiveFQDN, authZone) | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("webnames: %w", err) | ||||
| 		return fmt.Errorf("webnamesru: %w", err) | ||||
| 	} | ||||
|  | ||||
| 	err = d.client.AddTXTRecord(context.Background(), dns01.UnFqdn(authZone), subDomain, info.Value) | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("webnames: failed to create TXT records [domain: %s, sub domain: %s]: %w", | ||||
| 		return fmt.Errorf("webnamesru: failed to create TXT records [domain: %s, sub domain: %s]: %w", | ||||
| 			dns01.UnFqdn(authZone), subDomain, err) | ||||
| 	} | ||||
|  | ||||
| @@ -118,17 +120,17 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { | ||||
|  | ||||
| 	authZone, err := dns01.FindZoneByFqdn(info.EffectiveFQDN) | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("webnames: could not find zone for domain %q: %w", domain, err) | ||||
| 		return fmt.Errorf("webnamesru: could not find zone for domain %q: %w", domain, err) | ||||
| 	} | ||||
|  | ||||
| 	subDomain, err := dns01.ExtractSubDomain(info.EffectiveFQDN, authZone) | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("webnames: %w", err) | ||||
| 		return fmt.Errorf("webnamesru: %w", err) | ||||
| 	} | ||||
|  | ||||
| 	err = d.client.RemoveTXTRecord(context.Background(), dns01.UnFqdn(authZone), subDomain, info.Value) | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("webnames: failed to remove TXT records [domain: %s, sub domain: %s]: %w", | ||||
| 		return fmt.Errorf("webnamesru: failed to remove TXT records [domain: %s, sub domain: %s]: %w", | ||||
| 			dns01.UnFqdn(authZone), subDomain, err) | ||||
| 	} | ||||
|  | ||||
| @@ -140,3 +142,7 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { | ||||
| func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { | ||||
| 	return d.config.PropagationTimeout, d.config.PollingInterval | ||||
| } | ||||
|  | ||||
| func altEnvName(v string) string { | ||||
| 	return strings.ReplaceAll(v, envNamespace, altEnvNamespace) | ||||
| } | ||||
|   | ||||
| @@ -1,12 +1,13 @@ | ||||
| Name = "Webnames" | ||||
| Name = "webnames.ru" | ||||
| Description = '''''' | ||||
| URL = "https://www.webnames.ru/" | ||||
| Code = "webnames" | ||||
| Aliases = ["webnamesru"] | ||||
| Since = "v4.15.0" | ||||
|  | ||||
| Example = ''' | ||||
| WEBNAMES_API_KEY=xxxxxx \ | ||||
| lego --email you@example.com --dns webnames -d '*.example.com' -d example.com run | ||||
| WEBNAMESRU_API_KEY=xxxxxx \ | ||||
| lego --email you@example.com --dns webnamesru -d '*.example.com' -d example.com run | ||||
| ''' | ||||
|  | ||||
| Additional = ''' | ||||
| @@ -19,11 +20,11 @@ The API key can be found: Personal account / My domains and services / Select th | ||||
|  | ||||
| [Configuration] | ||||
|   [Configuration.Credentials] | ||||
|     WEBNAMES_API_KEY = "Domain API key" | ||||
|     WEBNAMESRU_API_KEY = "Domain API key" | ||||
|   [Configuration.Additional] | ||||
|     WEBNAMES_POLLING_INTERVAL = "Time between DNS propagation check in seconds (Default: 2)" | ||||
|     WEBNAMES_PROPAGATION_TIMEOUT = "Maximum waiting time for DNS propagation in seconds (Default: 60)" | ||||
|     WEBNAMES_HTTP_TIMEOUT = "API request timeout in seconds (Default: 30)" | ||||
|     WEBNAMESRU_POLLING_INTERVAL = "Time between DNS propagation check in seconds (Default: 2)" | ||||
|     WEBNAMESRU_PROPAGATION_TIMEOUT = "Maximum waiting time for DNS propagation in seconds (Default: 60)" | ||||
|     WEBNAMESRU_HTTP_TIMEOUT = "API request timeout in seconds (Default: 30)" | ||||
|  | ||||
| [Links] | ||||
|   API = "https://github.com/regtime-ltd/certbot-dns-webnames" | ||||
|   | ||||
| @@ -29,7 +29,7 @@ func TestNewDNSProvider(t *testing.T) { | ||||
| 			envVars: map[string]string{ | ||||
| 				EnvAPIKey: "", | ||||
| 			}, | ||||
| 			expected: "webnames: some credentials information are missing: WEBNAMES_API_KEY", | ||||
| 			expected: "webnamesru: some credentials information are missing: WEBNAMESRU_API_KEY", | ||||
| 		}, | ||||
| 	} | ||||
|  | ||||
| @@ -66,7 +66,7 @@ func TestNewDNSProviderConfig(t *testing.T) { | ||||
| 		}, | ||||
| 		{ | ||||
| 			desc:     "missing credentials", | ||||
| 			expected: "webnames: credentials missing", | ||||
| 			expected: "webnamesru: credentials missing", | ||||
| 		}, | ||||
| 	} | ||||
|  | ||||
|   | ||||
							
								
								
									
										2
									
								
								providers/dns/zz_gen_dns_providers.go
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								providers/dns/zz_gen_dns_providers.go
									
									
									
										generated
									
									
									
								
							| @@ -487,7 +487,7 @@ func NewDNSChallengeProviderByName(name string) (challenge.Provider, error) { | ||||
| 		return vscale.NewDNSProvider() | ||||
| 	case "vultr": | ||||
| 		return vultr.NewDNSProvider() | ||||
| 	case "webnames": | ||||
| 	case "webnames", "webnamesru": | ||||
| 		return webnames.NewDNSProvider() | ||||
| 	case "webnamesca": | ||||
| 		return webnamesca.NewDNSProvider() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user