aboutsummaryrefslogtreecommitdiffhomepage
path: root/context.go
diff options
context:
space:
mode:
authorMatt Holt <[email protected]>2021-04-30 10:14:52 -0600
committerGitHub <[email protected]>2021-04-30 10:14:52 -0600
commit956f01163d150b70aa3d5fc418ba9f150bd25c24 (patch)
treed69fd1f706d0bf73792a7787df6f6aaed98d35b2 /context.go
parentff6ca577ec7196e2cf3991c817d3655754de4b24 (diff)
downloadcaddy-956f01163d150b70aa3d5fc418ba9f150bd25c24.tar.gz
caddy-956f01163d150b70aa3d5fc418ba9f150bd25c24.zip
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.
Diffstat (limited to 'context.go')
-rw-r--r--context.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/context.go b/context.go
index c574be7d2..a6386aa82 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)
}