mirror of
https://github.com/go-acme/lego
synced 2026-03-14 14:35:48 +01:00
alidns: add line record option (#2814)
This commit is contained in:
parent
44b89b7e92
commit
2ce04a6586
4 changed files with 17 additions and 2 deletions
2
cmd/zz_gen_cmd_dnshelp.go
generated
2
cmd/zz_gen_cmd_dnshelp.go
generated
|
|
@ -263,8 +263,10 @@ func displayDNSHelp(w io.Writer, name string) error {
|
|||
|
||||
ew.writeln(`Additional Configuration:`)
|
||||
ew.writeln(` - "ALICLOUD_HTTP_TIMEOUT": API request timeout in seconds (Default: 10)`)
|
||||
ew.writeln(` - "ALICLOUD_LINE": Line (Default: default)`)
|
||||
ew.writeln(` - "ALICLOUD_POLLING_INTERVAL": Time between DNS propagation check in seconds (Default: 2)`)
|
||||
ew.writeln(` - "ALICLOUD_PROPAGATION_TIMEOUT": Maximum waiting time for DNS propagation in seconds (Default: 60)`)
|
||||
ew.writeln(` - "ALICLOUD_REGION_ID": Region ID (Default: cn-hangzhou)`)
|
||||
ew.writeln(` - "ALICLOUD_TTL": The TTL of the TXT record used for the DNS challenge in seconds (Default: 600)`)
|
||||
|
||||
ew.writeln()
|
||||
|
|
|
|||
2
docs/content/dns/zz_gen_alidns.md
generated
2
docs/content/dns/zz_gen_alidns.md
generated
|
|
@ -58,8 +58,10 @@ More information [here]({{% ref "dns#configuration-and-credentials" %}}).
|
|||
| Environment Variable Name | Description |
|
||||
|--------------------------------|-------------|
|
||||
| `ALICLOUD_HTTP_TIMEOUT` | API request timeout in seconds (Default: 10) |
|
||||
| `ALICLOUD_LINE` | Line (Default: default) |
|
||||
| `ALICLOUD_POLLING_INTERVAL` | Time between DNS propagation check in seconds (Default: 2) |
|
||||
| `ALICLOUD_PROPAGATION_TIMEOUT` | Maximum waiting time for DNS propagation in seconds (Default: 60) |
|
||||
| `ALICLOUD_REGION_ID` | Region ID (Default: cn-hangzhou) |
|
||||
| `ALICLOUD_TTL` | The TTL of the TXT record used for the DNS challenge in seconds (Default: 600) |
|
||||
|
||||
The environment variable names can be suffixed by `_FILE` to reference a file instead of a value.
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ const (
|
|||
EnvSecretKey = envNamespace + "SECRET_KEY"
|
||||
EnvSecurityToken = envNamespace + "SECURITY_TOKEN"
|
||||
EnvRegionID = envNamespace + "REGION_ID"
|
||||
EnvLine = envNamespace + "LINE"
|
||||
|
||||
EnvTTL = envNamespace + "TTL"
|
||||
EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT"
|
||||
|
|
@ -45,6 +46,7 @@ type Config struct {
|
|||
SecretKey string
|
||||
SecurityToken string
|
||||
RegionID string
|
||||
Line string
|
||||
PropagationTimeout time.Duration
|
||||
PollingInterval time.Duration
|
||||
TTL int
|
||||
|
|
@ -74,6 +76,7 @@ type DNSProvider struct {
|
|||
func NewDNSProvider() (*DNSProvider, error) {
|
||||
config := NewDefaultConfig()
|
||||
config.RegionID = env.GetOrFile(EnvRegionID)
|
||||
config.Line = env.GetOrFile(EnvLine)
|
||||
|
||||
values, err := env.Get(EnvRAMRole)
|
||||
if err == nil {
|
||||
|
|
@ -254,12 +257,18 @@ func (d *DNSProvider) newTxtRecord(zone, fqdn, value string) (*alidns.AddDomainR
|
|||
return nil, err
|
||||
}
|
||||
|
||||
return new(alidns.AddDomainRecordRequest).
|
||||
adrr := new(alidns.AddDomainRecordRequest).
|
||||
SetType("TXT").
|
||||
SetDomainName(zone).
|
||||
SetRR(rr).
|
||||
SetValue(value).
|
||||
SetTTL(int64(d.config.TTL)), nil
|
||||
SetTTL(int64(d.config.TTL))
|
||||
|
||||
if d.config.Line != "" {
|
||||
adrr.SetLine(d.config.Line)
|
||||
}
|
||||
|
||||
return adrr, nil
|
||||
}
|
||||
|
||||
func (d *DNSProvider) findTxtRecords(ctx context.Context, fqdn string) ([]*alidns.DescribeDomainRecordsResponseBodyDomainRecordsRecord, error) {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ lego --dns alidns - -d '*.example.com' -d example.com run
|
|||
ALICLOUD_SECRET_KEY = "Access Key secret"
|
||||
ALICLOUD_SECURITY_TOKEN = "STS Security Token (optional)"
|
||||
[Configuration.Additional]
|
||||
ALICLOUD_REGION_ID = "Region ID (Default: cn-hangzhou)"
|
||||
ALICLOUD_LINE = "Line (Default: default)"
|
||||
ALICLOUD_POLLING_INTERVAL = "Time between DNS propagation check in seconds (Default: 2)"
|
||||
ALICLOUD_PROPAGATION_TIMEOUT = "Maximum waiting time for DNS propagation in seconds (Default: 60)"
|
||||
ALICLOUD_TTL = "The TTL of the TXT record used for the DNS challenge in seconds (Default: 600)"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue