diff options
author | Francis Lavoie <[email protected]> | 2024-01-23 19:36:59 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2024-01-23 19:36:59 -0500 |
commit | 750d0b83319ac0ea6b7f057b8270c19404c3d6fa (patch) | |
tree | d0c3fb610cde8ae9d73a0a2caba94542af099770 /modules/caddytls/internalissuer.go | |
parent | 54823f52bc9aed66a1a37f820daf6e494181211a (diff) | |
download | caddy-750d0b83319ac0ea6b7f057b8270c19404c3d6fa.tar.gz caddy-750d0b83319ac0ea6b7f057b8270c19404c3d6fa.zip |
caddyfile: Normalize & flatten all unmarshalers (#6037)
Diffstat (limited to 'modules/caddytls/internalissuer.go')
-rw-r--r-- | modules/caddytls/internalissuer.go | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/modules/caddytls/internalissuer.go b/modules/caddytls/internalissuer.go index 1cf2461ab..cdc4f493b 100644 --- a/modules/caddytls/internalissuer.go +++ b/modules/caddytls/internalissuer.go @@ -155,31 +155,30 @@ func (iss InternalIssuer) Issue(ctx context.Context, csr *x509.CertificateReques // sign_with_root // } func (iss *InternalIssuer) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { - for d.Next() { - for d.NextBlock(0) { - switch d.Val() { - case "ca": - if !d.AllArgs(&iss.CA) { - return d.ArgErr() - } - - case "lifetime": - if !d.NextArg() { - return d.ArgErr() - } - dur, err := caddy.ParseDuration(d.Val()) - if err != nil { - return err - } - iss.Lifetime = caddy.Duration(dur) - - case "sign_with_root": - if d.NextArg() { - return d.ArgErr() - } - iss.SignWithRoot = true + d.Next() // consume issuer name + for d.NextBlock(0) { + switch d.Val() { + case "ca": + if !d.AllArgs(&iss.CA) { + return d.ArgErr() + } + case "lifetime": + if !d.NextArg() { + return d.ArgErr() + } + dur, err := caddy.ParseDuration(d.Val()) + if err != nil { + return err } + iss.Lifetime = caddy.Duration(dur) + + case "sign_with_root": + if d.NextArg() { + return d.ArgErr() + } + iss.SignWithRoot = true + } } return nil |