Refactor to flat APIKey model with quota, admin UI, .env config, and Berlin timezone

- Remove User/Quota models; quota fields now live directly on APIKey
- Admin UI: login, API key management, settings (Ollama URL/model), proxy info display
- .env/.env.example: ADMIN_PASSWORD, PROXY_HOST/PORT, DATABASE_URL, APP_TZ
- Admin API runs on 127.0.0.1 only; proxy host/port configurable
- API keys support optional expires_at; verified against Europe/Berlin timezone
- Daily/monthly quota resets use Europe/Berlin midnight boundary
- Fix all tests to use new flat model; add expiry tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Oliver Hofmann
2026-04-28 08:21:42 +02:00
co-authored by Claude Sonnet 4.6
parent cfa874a4c3
commit c8235ec274
15 changed files with 824 additions and 471 deletions
+18
View File
@@ -0,0 +1,18 @@
# Admin-Passwort für die Weboberfläche
ADMIN_PASSWORD=change-me
# Lokaler Endpunkt des Proxys (Admin-API bindet immer auf 127.0.0.1)
PROXY_HOST=0.0.0.0
PROXY_PORT=8000
ADMIN_PORT=8001
# Datenbankverbindung (Standard: SQLite für Entwicklung)
DATABASE_URL=sqlite:///./test.db
# Beispiel für PostgreSQL (Produktion):
# DATABASE_URL=postgresql://user:password@localhost:5432/llm_quota
# Ollama-Einstellungen (auch in der Admin-Oberfläche änderbar)
OLLAMA_URL=http://localhost:11434
DEFAULT_MODEL=llama3
APP_TZ=Europe/Berlin