From c95db3551d79112513196b71841de8d010a42b25 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 30 Sep 2019 11:53:21 -0600 Subject: caddytls: Ensure automation field is not nil when appending (fix #2779) --- caddyconfig/httpcaddyfile/httptype.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'caddyconfig') diff --git a/caddyconfig/httpcaddyfile/httptype.go b/caddyconfig/httpcaddyfile/httptype.go index 794919c..c8602f3 100644 --- a/caddyconfig/httpcaddyfile/httptype.go +++ b/caddyconfig/httpcaddyfile/httptype.go @@ -182,6 +182,9 @@ func (st ServerType) Setup(originalServerBlocks []caddyfile.ServerBlock, return nil, warnings, err } if len(sblockHosts) > 0 { + if tlsApp.Automation == nil { + tlsApp.Automation = new(caddytls.AutomationConfig) + } tlsApp.Automation.Policies = append(tlsApp.Automation.Policies, caddytls.AutomationPolicy{ Hosts: sblockHosts, ManagementRaw: caddyconfig.JSONModuleObject(mm, "module", mm.(caddy.Module).CaddyModule().ID(), &warnings), -- cgit v1.2.3