From 1e662262179d326586d2beb849f842b82b7324c4 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 30 Sep 2019 09:11:30 -0600 Subject: httpcaddyfile: Add acme_ca and email global options Also add ability to access options from individual unmarshalers through the Helper values --- caddyconfig/httpcaddyfile/builtins.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'caddyconfig/httpcaddyfile/builtins.go') diff --git a/caddyconfig/httpcaddyfile/builtins.go b/caddyconfig/httpcaddyfile/builtins.go index ff93b11..ec3740c 100644 --- a/caddyconfig/httpcaddyfile/builtins.go +++ b/caddyconfig/httpcaddyfile/builtins.go @@ -86,6 +86,14 @@ func parseTLS(h Helper) ([]ConfigValue, error) { var mgr caddytls.ACMEManagerMaker var off bool + // fill in global defaults, if configured + if email := h.Option("email"); email != nil { + mgr.Email = email.(string) + } + if acmeCA := h.Option("acme_ca"); acmeCA != nil { + mgr.CA = acmeCA.(string) + } + for h.Next() { // file certificate loader firstLine := h.RemainingArgs() @@ -112,7 +120,6 @@ func parseTLS(h Helper) ([]ConfigValue, error) { hasBlock = true switch h.Val() { - // connection policy case "protocols": args := h.RemainingArgs() @@ -164,7 +171,8 @@ func parseTLS(h Helper) ([]ConfigValue, error) { } mgr.CA = arg[0] - // TODO: other properties for automation manager + default: + return nil, h.Errf("unknown subdirective: %s", h.Val()) } } -- cgit v1.2.3