mirror of
https://github.com/go-acme/lego
synced 2026-03-14 14:35:48 +01:00
alidns: add line
This commit is contained in:
parent
44b89b7e92
commit
7f58dec759
2 changed files with 13 additions and 2 deletions
|
|
@ -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