burn: Fix crisis backend tests, gateway injection, and nginx rate limiting

- Fixed test imports (relative → absolute package imports)
- Added conftest.py for pytest path configuration
- Fixed get_system_prompt() to inject crisis context when detected
- Added pytest.ini configuration
- Expanded tests: 49 tests covering detection, response, gateway, edge cases, router
- Added deploy/rate-limit.conf for nginx http block inclusion
- Updated nginx.conf with correct zone name and limit_req_status 429
- Updated BACKEND_SETUP.md with complete setup instructions
This commit is contained in:
Alexander Whitestone
2026-04-09 12:34:15 -04:00
parent 0dab8dfcfc
commit bb4ba82ac8
7 changed files with 268 additions and 28 deletions

View File

@@ -1,5 +1,9 @@
# The Door — nginx config for alexanderwhitestone.com
# Place at /etc/nginx/sites-available/the-door
#
# IMPORTANT: Also include deploy/rate-limit.conf in your main
# /etc/nginx/nginx.conf http block:
# include /etc/nginx/sites-available/the-door/deploy/rate-limit.conf;
server {
listen 80;
@@ -57,15 +61,14 @@ server {
chunked_transfer_encoding on;
proxy_read_timeout 300s;
# Rate limiting
limit_req zone=api burst=5 nodelay;
# Rate limiting — 10 req/min per IP, burst of 5
# Zone must be defined in nginx http block — see deploy/rate-limit.conf
limit_req zone=the_door_api burst=5 nodelay;
limit_req_status 429;
}
# Health check
location /health {
proxy_pass http://127.0.0.1:8644/health;
}
# Rate limit zone (define in http block of nginx.conf)
# limit_req_zone $binary_remote_addr zone=api:10m rate=10r/m;
}