Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates API server initialization to skip rate limiting (and currently also metrics collection) when running in a local development environment, based on config.Env.
Changes:
- Introduces an
isLocalDevenvironment check (dev/development) during server setup. - Prevents initialization of
RateLimitMiddleware(andMetricsCollector) whenisLocalDevis true.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
@rickyrombo I've opened a new pull request, #715, to work on those changes. Once the pull request is ready, I'll request review from you. |
Contributor
|
@rickyrombo I've opened a new pull request, #716, to work on those changes. Once the pull request is ready, I'll request review from you. |
`isLocalDev` only checked for `"dev"` and `"development"`, but `config/config.go` treats `ENV=""` identically (same switch fallthrough). With `ENV` unset, rate limiting remained enabled despite the local dev intent. ## Changes - **`api/server.go`**: Add `config.Env == ""` to `isLocalDev` to match `config.go` semantics: ```go // Before isLocalDev := config.Env == "dev" || config.Env == "development" // After isLocalDev := config.Env == "dev" || config.Env == "development" || config.Env == "" ``` <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/AudiusProject/api/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: rickyrombo <3690498+rickyrombo@users.noreply.github.com>
…dleware (#716) The previous change mistakenly disabled both `metricsCollector` and `rateLimitMiddleware` in local dev environments. Only rate limiting should be skipped in local dev. ## Changes - **`api/server.go`**: Split the single initialization guard into two separate conditions: - `metricsCollector` — gated on `writePool != nil && config.Env != "test"` (enabled in local dev) - `rateLimitMiddleware` — additionally gated on `!isLocalDev` (disabled in local dev) ```go if writePool != nil && config.Env != "test" { metricsCollector = NewMetricsCollector(logger, writePool) if !isLocalDev { rateLimitMiddleware = NewRateLimitMiddleware(logger, writePool) } } ``` <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: rickyrombo <3690498+rickyrombo@users.noreply.github.com>
raymondjacobson
approved these changes
Mar 11, 2026
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.
No description provided.