- Batch device CRUD: POST /api/devices/batch (create 500), PUT /api/devices/batch (update 500), POST /api/devices/batch-delete (delete 100) with WHERE IN bulk queries - Batch command: POST /api/commands/batch with model_validator mutual exclusion - API key auth (X-API-Key header, secrets.compare_digest timing-safe) - Rate limiting via SlowAPIMiddleware (60/min default, 30/min writes) - Real client IP extraction (X-Forwarded-For / CF-Connecting-IP) - Global exception handler (no stack trace leaks, passes HTTPException through) - CORS with auto-disable credentials on wildcard origins - Schema validation: IMEI pattern, lat/lon ranges, Literal enums, MAC/UUID patterns - Heartbeats router, per-ID endpoints for locations/attendance/bluetooth - Input dedup in batch create, result ordering preserved - Baidu reverse geocoding, Gaode map tiles with WGS84→GCJ02 conversion - Device detail panel with feature toggles and command controls - Side panel for location/beacon pages with auto-select active device via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run>
44 lines
1.3 KiB
Plaintext
44 lines
1.3 KiB
Plaintext
# KKS Badge Management System - Environment Configuration
|
|
# Copy to .env and customize values as needed
|
|
|
|
# Database (default: SQLite in project root)
|
|
# DATABASE_URL=sqlite+aiosqlite:///path/to/badge_admin.db
|
|
# DATABASE_URL=postgresql+asyncpg://user:password@localhost/badge_admin
|
|
|
|
# Server ports
|
|
# TCP_PORT=5000
|
|
# API_PORT=8088
|
|
|
|
# Debug mode (default: false)
|
|
# DEBUG=true
|
|
|
|
# API authentication (uncomment to enable, all /api/ endpoints require X-API-Key header)
|
|
# API_KEY=your-secret-api-key-here
|
|
|
|
# CORS origins (comma-separated, * = allow all)
|
|
# CORS_ORIGINS=https://example.com,https://admin.example.com
|
|
|
|
# Rate limiting (format: "count/period", period = second/minute/hour/day)
|
|
# RATE_LIMIT_DEFAULT=60/minute
|
|
# RATE_LIMIT_WRITE=30/minute
|
|
|
|
# Track query max points (default: 10000)
|
|
# TRACK_MAX_POINTS=10000
|
|
|
|
# 天地图 API key (reverse geocoding, free 10k/day)
|
|
# Sign up: https://lbs.tianditu.gov.cn/
|
|
# TIANDITU_API_KEY=your_tianditu_key
|
|
|
|
# Google Geolocation API (optional, for cell/WiFi geocoding)
|
|
# GOOGLE_API_KEY=your_google_key
|
|
|
|
# Unwired Labs API (optional, for cell/WiFi geocoding)
|
|
# UNWIRED_API_TOKEN=your_unwired_token
|
|
|
|
# 高德地图 API (optional, requires enterprise auth for IoT positioning)
|
|
# AMAP_KEY=your_amap_key
|
|
# AMAP_SECRET=your_amap_secret
|
|
|
|
# Geocoding cache size
|
|
# GEOCODING_CACHE_SIZE=10000
|