mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 22:19:40 +02:00
Add auth.py module to both STT and TTS services with: - API key validation via X-API-Key header - Rate limiting with sliding window (requests per minute) - Internal API key option for unlimited access - Environment variable configuration All protected endpoints now require authentication. Public endpoints (/health, /docs) remain accessible.
36 lines
888 B
Text
36 lines
888 B
Text
# ManaCore TTS Service Configuration
|
|
# Copy to .env and adjust values as needed
|
|
|
|
# Server
|
|
PORT=3022
|
|
|
|
# Models
|
|
# Set to true to preload models on startup (slower startup, faster first request)
|
|
PRELOAD_MODELS=false
|
|
|
|
# Text Limits
|
|
MAX_TEXT_LENGTH=1000
|
|
|
|
# CORS Origins (comma-separated)
|
|
CORS_ORIGINS=https://mana.how,https://chat.mana.how,http://localhost:5173
|
|
|
|
# ===========================================
|
|
# Authentication
|
|
# ===========================================
|
|
|
|
# Enable API key authentication (default: true for production)
|
|
REQUIRE_AUTH=true
|
|
|
|
# API Keys (comma-separated, format: key:name)
|
|
# Example: sk-abc123:myapp,sk-def456:testuser
|
|
API_KEYS=
|
|
|
|
# Internal API key (no rate limit, for internal services)
|
|
# Generate with: openssl rand -hex 32
|
|
INTERNAL_API_KEY=
|
|
|
|
# Rate Limiting
|
|
# Requests per window per API key
|
|
RATE_LIMIT_REQUESTS=60
|
|
# Window size in seconds
|
|
RATE_LIMIT_WINDOW=60
|