Backend (FastAPI + PostgreSQL): Chargen mit MHD, FEFO-Auslagern, Einheiten-Umrechnung (Stueck/g/ml + Packungen), Open-Food-Facts-Lookup mit lokalem Fallback, JWT-Auth mit Rollen (Admin/Nutzer), erster Admin beim Setup, Einkaufsliste, Ablaufwarnung, Lagerorte, pytest fuer FEFO. Web-UI (React/Vite): Login, Dashboard, Ein-/Auslagern, Produkte, Lagerorte, Benutzerverwaltung, Einkaufsliste - rollenabhaengig. Deploy: docker-compose + install.sh (Docker-Autoinstall, Secrets), README und Roadmap fuer Schritt 2 (iOS) und Schritt 3. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
35 lines
895 B
Python
35 lines
895 B
Python
from functools import lru_cache
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
|
|
|
|
# Database
|
|
database_url: str = "postgresql+psycopg2://pantry:pantry@localhost:5432/pantry"
|
|
|
|
# Auth / JWT
|
|
jwt_secret: str = "change-me-in-production"
|
|
jwt_algorithm: str = "HS256"
|
|
jwt_expire_minutes: int = 60 * 24 * 7 # 7 days
|
|
|
|
# First admin, created on startup if no users exist
|
|
admin_username: str = "admin"
|
|
admin_password: str = "changeme"
|
|
|
|
# Open Food Facts
|
|
off_base_url: str = "https://world.openfoodfacts.org"
|
|
off_timeout_seconds: float = 8.0
|
|
|
|
# Behaviour
|
|
expiry_warning_days_default: int = 7
|
|
|
|
# CORS (comma separated); "*" allows all
|
|
cors_origins: str = "*"
|
|
|
|
|
|
@lru_cache
|
|
def get_settings() -> Settings:
|
|
return Settings()
|