UnmarshalCaddyfile deserializes Caddyfile tokens into iss. ... acme [<directory_url>] { dir <directory_url> test_dir <test_directory_url> email <email> profile <profile_name> timeout <duration> disable_http_challenge disable_tlsalpn_challenge alt_http_port
(d *caddyfile.Dispenser)
| 446 | // } |
| 447 | // } |
| 448 | func (iss *ACMEIssuer) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { |
| 449 | d.Next() // consume issuer name |
| 450 | |
| 451 | if d.NextArg() { |
| 452 | iss.CA = d.Val() |
| 453 | if d.NextArg() { |
| 454 | return d.ArgErr() |
| 455 | } |
| 456 | } |
| 457 | |
| 458 | for d.NextBlock(0) { |
| 459 | switch d.Val() { |
| 460 | case "lifetime": |
| 461 | var lifetimeStr string |
| 462 | if !d.AllArgs(&lifetimeStr) { |
| 463 | return d.ArgErr() |
| 464 | } |
| 465 | lifetime, err := caddy.ParseDuration(lifetimeStr) |
| 466 | if err != nil { |
| 467 | return d.Errf("invalid lifetime %s: %v", lifetimeStr, err) |
| 468 | } |
| 469 | if lifetime < 0 { |
| 470 | return d.Errf("lifetime must be >= 0: %s", lifetime) |
| 471 | } |
| 472 | iss.CertificateLifetime = caddy.Duration(lifetime) |
| 473 | |
| 474 | case "dir": |
| 475 | if iss.CA != "" { |
| 476 | return d.Errf("directory is already specified: %s", iss.CA) |
| 477 | } |
| 478 | if !d.AllArgs(&iss.CA) { |
| 479 | return d.ArgErr() |
| 480 | } |
| 481 | |
| 482 | case "test_dir": |
| 483 | if !d.AllArgs(&iss.TestCA) { |
| 484 | return d.ArgErr() |
| 485 | } |
| 486 | |
| 487 | case "email": |
| 488 | if !d.AllArgs(&iss.Email) { |
| 489 | return d.ArgErr() |
| 490 | } |
| 491 | |
| 492 | case "profile": |
| 493 | if !d.AllArgs(&iss.Profile) { |
| 494 | return d.ArgErr() |
| 495 | } |
| 496 | |
| 497 | case "timeout": |
| 498 | var timeoutStr string |
| 499 | if !d.AllArgs(&timeoutStr) { |
| 500 | return d.ArgErr() |
| 501 | } |
| 502 | timeout, err := caddy.ParseDuration(timeoutStr) |
| 503 | if err != nil { |
| 504 | return d.Errf("invalid timeout duration %s: %v", timeoutStr, err) |
| 505 | } |
nothing calls this directly
no test coverage detected