Skip to content

Commit

Permalink
Fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
popcorn committed Jun 28, 2024
1 parent 6193a40 commit 32cf4ff
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ type Handler struct {
// the global or default storage configuration will be used.
StorageRaw json.RawMessage `json:"storage,omitempty" caddy:"namespace=caddy.storage inline_key=module"`

// LogKey, if true, will log the key used for rate limiting.
// Defaults to `false` because keys can contain sensitive information.
LogKey bool `json:"log_key,omitempty"`
// LogKey, if true, will log the key used for rate limiting.
// Defaults to `false` because keys can contain sensitive information.
LogKey bool `json:"log_key,omitempty"`

rateLimits []*RateLimit
storage certmagic.Storage
Expand Down Expand Up @@ -204,19 +204,19 @@ func (h *Handler) rateLimitExceeded(w http.ResponseWriter, r *http.Request, repl
}

if h.LogKey {
h.logger.Info("rate limit exceeded",
zap.String("zone", zoneName),
zap.String("key", key),
zap.Duration("wait", wait),
zap.String("remote_ip", remoteIP),
)
} else {
h.logger.Info("rate limit exceeded",
zap.String("zone", zoneName),
zap.Duration("wait", wait),
zap.String("remote_ip", remoteIP),
)
}
h.logger.Info("rate limit exceeded",
zap.String("zone", zoneName),
zap.String("key", key),
zap.Duration("wait", wait),
zap.String("remote_ip", remoteIP),
)
} else {
h.logger.Info("rate limit exceeded",
zap.String("zone", zoneName),
zap.Duration("wait", wait),
zap.String("remote_ip", remoteIP),
)
}

// make some information about this rate limit available
repl.Set("http.rate_limit.exceeded.name", zoneName)
Expand Down

0 comments on commit 32cf4ff

Please sign in to comment.