Die Kategorie bestimmt die Verwaltungsart (food/object). Gegenstaende: Menge je Lagerort statt Chargen/MHD, Umlagern (ohne Grund) und Entfernen mit Pflicht-Grund samt Entnahme-Statistik. Beliebig viele eigene Felder je Kategorie (vererbt an Unterkategorien), "gekauft bei" ueber eine verwaltbare Shop-Liste und ein Produktlink. Barcode-Lookup zusaetzlich ueber Open Products Facts. Der Lebensmittel-Teil (Chargen/MHD/FEFO) bleibt unveraendert. Umgesetzt in Backend (FastAPI, +Tests gruen), Web (React) und iOS (SwiftUI). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
37 lines
1.0 KiB
Python
37 lines
1.0 KiB
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://vorrania:vorrania@localhost:5432/vorrania"
|
||
|
||
# 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 (Lebensmittel)
|
||
off_base_url: str = "https://world.openfoodfacts.org"
|
||
# Open Products Facts (allgemeine Produkte / Gegenstände) – gleiche API-Struktur.
|
||
opf_base_url: str = "https://world.openproductsfacts.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()
|