Skip to content

Commit

Permalink
otc: sequential challenge (#2023)
Browse files Browse the repository at this point in the history
  • Loading branch information
volayvaz authored Sep 21, 2023
1 parent b523518 commit c2fd449
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/zz_gen_cmd_dnshelp.go
Original file line number Diff line number Diff line change
Expand Up @@ -2030,6 +2030,7 @@ func displayDNSHelp(w io.Writer, name string) error {
ew.writeln(` - "OTC_HTTP_TIMEOUT": API request timeout`)
ew.writeln(` - "OTC_POLLING_INTERVAL": Time between DNS propagation check`)
ew.writeln(` - "OTC_PROPAGATION_TIMEOUT": Maximum waiting time for DNS propagation`)
ew.writeln(` - "OTC_SEQUENCE_INTERVAL": Time between sequential requests`)
ew.writeln(` - "OTC_TTL": The TTL of the TXT record used for the DNS challenge`)

ew.writeln()
Expand Down
1 change: 1 addition & 0 deletions docs/content/dns/zz_gen_otc.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ More information [here]({{< ref "dns#configuration-and-credentials" >}}).
| `OTC_HTTP_TIMEOUT` | API request timeout |
| `OTC_POLLING_INTERVAL` | Time between DNS propagation check |
| `OTC_PROPAGATION_TIMEOUT` | Maximum waiting time for DNS propagation |
| `OTC_SEQUENCE_INTERVAL` | Time between sequential requests |
| `OTC_TTL` | The TTL of the TXT record used for the DNS challenge |

The environment variable names can be suffixed by `_FILE` to reference a file instead of a value.
Expand Down
9 changes: 9 additions & 0 deletions providers/dns/otc/otc.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const (
EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT"
EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL"
)

// Config is used to configure the creation of the DNSProvider.
Expand All @@ -44,6 +45,7 @@ type Config struct {
Password string
PropagationTimeout time.Duration
PollingInterval time.Duration
SequenceInterval time.Duration
TTL int
HTTPClient *http.Client
}
Expand All @@ -55,6 +57,7 @@ func NewDefaultConfig() *Config {
PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, dns01.DefaultPropagationTimeout),
PollingInterval: env.GetOrDefaultSecond(EnvPollingInterval, dns01.DefaultPollingInterval),
IdentityEndpoint: env.GetOrDefaultString(EnvIdentityEndpoint, defaultIdentityEndpoint),
SequenceInterval: env.GetOrDefaultSecond(EnvSequenceInterval, dns01.DefaultPropagationTimeout),
HTTPClient: &http.Client{
Timeout: env.GetOrDefaultSecond(EnvHTTPTimeout, 10*time.Second),
Transport: &http.Transport{
Expand Down Expand Up @@ -202,3 +205,9 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
func (d *DNSProvider) Timeout() (timeout, interval time.Duration) {
return d.config.PropagationTimeout, d.config.PollingInterval
}

// Sequential All DNS challenges for this provider will be resolved sequentially.
// Returns the interval between each iteration.
func (d *DNSProvider) Sequential() time.Duration {
return d.config.SequenceInterval
}
1 change: 1 addition & 0 deletions providers/dns/otc/otc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Example = ''''''
[Configuration.Additional]
OTC_POLLING_INTERVAL = "Time between DNS propagation check"
OTC_PROPAGATION_TIMEOUT = "Maximum waiting time for DNS propagation"
OTC_SEQUENCE_INTERVAL = "Time between sequential requests"
OTC_TTL = "The TTL of the TXT record used for the DNS challenge"
OTC_HTTP_TIMEOUT = "API request timeout"

Expand Down

0 comments on commit c2fd449

Please sign in to comment.