feat: adds rate limiter middleware#91
Merged
Merged
Conversation
Signed-off-by: Amit Singh <singhamitch@outlook.com>
c23d7e8 to
55c6d9f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #89
Summary by cubic
Add a token-bucket rate limiter (10 RPS, burst 20) applied to all API routes via middleware, with an env flag to disable in dev/tests. Also serves a JSON /ping route directly in Gin and removes it from the OpenAPI-generated server and spec.
New Features
RateLimiterMiddlewareusinggolang.org/x/time/rate; enabled by default.RATE_LIMIT_DISABLED=true./pingnow handled by Gin (JSON response) and removed from the OpenAPI spec and generated server.Migration
RATE_LIMIT_DISABLED=truelocally or in tests to avoid throttling (acceptance compose updated)./ping; callGET /pingdirectly if needed.Written for commit 55c6d9f. Summary will update on new commits.