fix(routes): apply rate-limit and metrics middleware to /api/v2

The authenticated v1 group installs setupRateLimit and
setupMetricsMiddleware; the v2 group only had cache-control and token
middleware, so authenticated v2 endpoints bypassed the configured API
rate limiter and route metrics. Mirror the v1 stack.
This commit is contained in:
kolaente 2026-05-30 22:51:50 +02:00 committed by kolaente
parent d2a3186b3e
commit 14446e3c41
1 changed files with 4 additions and 0 deletions

View File

@ -382,6 +382,10 @@ func noStoreCacheControl() echo.MiddlewareFunc {
func registerAPIRoutesV2(e *echo.Echo, a *echo.Group) {
a.Use(noStoreCacheControl())
a.Use(SetupTokenMiddleware())
// Match the authenticated v1 group: rate limiting and route metrics
// apply to v2 resource endpoints too.
setupRateLimit(a, config.RateLimitKind.GetString())
setupMetricsMiddleware(a)
api := apiv2.NewAPI(e, a)