Skip to content

Commit

Permalink
caddytls: Add Caddyfile support for propagation_timeout (#4178)
Browse files Browse the repository at this point in the history
* add propagation_timeout to UnmarshalCaddyfile

- Closes #4177

* added caddyfile_adapt test
  • Loading branch information
kmpm committed Jun 7, 2021
1 parent f9b5445 commit 4c2da18
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
70 changes: 70 additions & 0 deletions caddytest/integration/caddyfile_adapt/tls_propagation_timeout.txt
@@ -0,0 +1,70 @@
localhost

respond "hello from localhost"
tls {
issuer acme {
propagation_timeout "10m0s"
}
}
----------
{
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":443"
],
"routes": [
{
"match": [
{
"host": [
"localhost"
]
}
],
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"body": "hello from localhost",
"handler": "static_response"
}
]
}
]
}
],
"terminal": true
}
]
}
}
},
"tls": {
"automation": {
"policies": [
{
"subjects": [
"localhost"
],
"issuers": [
{
"challenges": {
"dns": {
"propagation_timeout": 600000000000
}
},
"module": "acme"
}
]
}
]
}
}
}
}
16 changes: 16 additions & 0 deletions modules/caddytls/acmeissuer.go
Expand Up @@ -387,6 +387,22 @@ func (iss *ACMEIssuer) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
return err
}
iss.Challenges.DNS.ProviderRaw = caddyconfig.JSONModuleObject(unm, "name", provName, nil)
case "propagation_timeout":
if !d.NextArg() {
return d.ArgErr()
}
timeoutStr := d.Val()
timeout, err := caddy.ParseDuration(timeoutStr)
if err != nil {
return d.Errf("invalid propagation_timeout duration %s: %v", timeoutStr, err)
}
if iss.Challenges == nil {
iss.Challenges = new(ChallengesConfig)
}
if iss.Challenges.DNS == nil {
iss.Challenges.DNS = new(DNSChallengeConfig)
}
iss.Challenges.DNS.PropagationTimeout = caddy.Duration(timeout)

case "resolvers":
if iss.Challenges == nil {
Expand Down

0 comments on commit 4c2da18

Please sign in to comment.