Files
Vorrania/backend/app/config.py
Scarriffle dc1750d23a Umbenennung in Vorrania vollstaendig durchziehen
Auf ausdruecklichen Wunsch jetzt auch die internen Bezeichner, weil die
Installation noch keine echten Daten enthaelt: POSTGRES_USER/PASSWORD/DB, der
Volume-Name, die Standard-DATABASE_URL, der localStorage-Schluessel und die
iOS-Zeichenketten inklusive Keychain-Konto.

Das setzt eine leere Datenbank voraus: Der neue Volume-Name legt eine neue,
leere Datenbank an. Die alte bleibt als verwaistes Volume liegen und muss von
Hand entfernt werden.

Die Warnung in docker-compose.yml bleibt stehen, damit eine spaetere
Umbenennung nicht versehentlich mit Daten im Volume passiert.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 13:13:11 +02:00

35 lines
901 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://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
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()