diff --git a/src/porchlight/app.py b/src/porchlight/app.py index 91bb490..d399923 100644 --- a/src/porchlight/app.py +++ b/src/porchlight/app.py @@ -128,6 +128,7 @@ def create_app(settings: Settings | None = None) -> FastAPI: ) # Rate limiting + limiter.enabled = settings.rate_limit_enabled app.state.limiter = limiter @app.exception_handler(RateLimitExceeded) diff --git a/src/porchlight/config.py b/src/porchlight/config.py index 90e036e..38fb597 100644 --- a/src/porchlight/config.py +++ b/src/porchlight/config.py @@ -52,6 +52,9 @@ class Settings(BaseSettings): # Magic links invite_ttl: int = 86400 # seconds + # Rate limiting (disable for e2e/load tests that authenticate repeatedly) + rate_limit_enabled: bool = True + # Signing keys signing_key_path: str = "data/keys" diff --git a/tests/e2e/run.sh b/tests/e2e/run.sh index 7a9f9b4..7b6156e 100755 --- a/tests/e2e/run.sh +++ b/tests/e2e/run.sh @@ -28,6 +28,7 @@ echo "Starting Porchlight on port ${PORT}..." echo " DB: ${OIDC_OP_SQLITE_PATH}" OIDC_OP_ISSUER="${TARGET_URL}" \ OIDC_OP_DEBUG=true \ +OIDC_OP_RATE_LIMIT_ENABLED=false \ uv run --directory "$PROJECT_ROOT" \ uvicorn porchlight.app:create_app \ --factory --host 127.0.0.1 --port "$PORT" \