From 76d398485ff6725892c4a598848236e919a178b9 Mon Sep 17 00:00:00 2001 From: Steffen Busch <37350514+steffenbusch@users.noreply.github.com> Date: Sun, 14 Jul 2024 01:20:40 +0200 Subject: [PATCH] Caddyfile support for log_key (#62) --- README.md | 6 ++++-- caddyfile.go | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 892bcc7..0ea14f2 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ rate_limit { write_interval purge_age } - log_key + log_key storage jitter sweep_interval @@ -205,7 +205,8 @@ We also enable distributed rate limiting. By deploying this config to two or mor "max_events": 2 } }, - "distributed": {} + "distributed": {}, + "log_key": true }, { "handler": "static_response", @@ -241,6 +242,7 @@ rate_limit { events 2 window 5s } + log_key } respond "I'm behind the rate limiter!" diff --git a/caddyfile.go b/caddyfile.go index b7bd629..86ed9f3 100644 --- a/caddyfile.go +++ b/caddyfile.go @@ -168,6 +168,12 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { } } + case "log_key": + if d.NextArg() { + return d.ArgErr() + } + h.LogKey = true + case "storage": if !d.NextArg() { return d.ArgErr()