feat: Projekt-Geruest finance/ mit Config und Test-Setup
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
0
finance/app/__init__.py
Normal file
0
finance/app/__init__.py
Normal file
34
finance/app/config.py
Normal file
34
finance/app/config.py
Normal file
@@ -0,0 +1,34 @@
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
from decimal import Decimal
|
||||
from functools import lru_cache
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Settings:
|
||||
database_url: str
|
||||
api_key: str
|
||||
gui_user: str
|
||||
gui_password_hash: str
|
||||
session_secret: str
|
||||
inbox_dir: Path
|
||||
uploads_dir: Path
|
||||
warn_threshold: Decimal
|
||||
horizon_days: int
|
||||
|
||||
|
||||
@lru_cache
|
||||
def get_settings() -> Settings:
|
||||
e = os.environ.get
|
||||
return Settings(
|
||||
database_url=e("FB_DATABASE_URL", "sqlite:///./fb.sqlite"),
|
||||
api_key=e("FB_API_KEY", ""),
|
||||
gui_user=e("FB_GUI_USER", "admin"),
|
||||
gui_password_hash=e("FB_GUI_PASSWORD_HASH", ""),
|
||||
session_secret=e("FB_SESSION_SECRET", "dev-secret"),
|
||||
inbox_dir=Path(e("FB_INBOX_DIR", "./inbox")),
|
||||
uploads_dir=Path(e("FB_UPLOADS_DIR", "./uploads")),
|
||||
warn_threshold=Decimal(e("FB_WARN_THRESHOLD", "0")),
|
||||
horizon_days=int(e("FB_HORIZON_DAYS", "548")),
|
||||
)
|
||||
Reference in New Issue
Block a user