From 956f01163d150b70aa3d5fc418ba9f150bd25c24 Mon Sep 17 00:00:00 2001 From: Matt Holt Date: Fri, 30 Apr 2021 10:14:52 -0600 Subject: caddytls: Implement remote IP connection matcher (#4123) * caddytls: Implement remote IP connection matcher * Implement IP range negation If both Ranges and NotRanges are specified, both must match. --- context.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'context.go') diff --git a/context.go b/context.go index c574be7..a6386aa 100644 --- a/context.go +++ b/context.go @@ -430,5 +430,13 @@ func (ctx Context) Storage() certmagic.Storage { // Logger returns a logger that can be used by mod. func (ctx Context) Logger(mod Module) *zap.Logger { + if ctx.cfg == nil { + // often the case in tests; just use a dev logger + l, err := zap.NewDevelopment() + if err != nil { + panic("config missing, unable to create dev logger: " + err.Error()) + } + return l + } return ctx.cfg.Logging.Logger(mod) } -- cgit v1.2.3