From af26a03da1af7cd7d64fc03270961829d0311ed7 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Fri, 15 Nov 2019 17:01:07 -0700 Subject: http: Only enable access logs if configured --- modules/caddyhttp/caddyhttp.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'modules/caddyhttp/caddyhttp.go') diff --git a/modules/caddyhttp/caddyhttp.go b/modules/caddyhttp/caddyhttp.go index 36d8154..7830828 100644 --- a/modules/caddyhttp/caddyhttp.go +++ b/modules/caddyhttp/caddyhttp.go @@ -76,9 +76,13 @@ func (app *App) Provision(ctx caddy.Context) error { for srvName, srv := range app.Servers { srv.logger = app.logger.Named("log") - srv.accessLogger = app.logger.Named("log.access") srv.errorLogger = app.logger.Named("log.error") + // only enable access logs if configured + if srv.Logs != nil { + srv.accessLogger = app.logger.Named("log.access") + } + if srv.AutoHTTPS == nil { // avoid nil pointer dereferences srv.AutoHTTPS = new(AutoHTTPSConfig) -- cgit v1.2.3