Files
vermietungs-tool/app/config.py
T
BlackMarkandClaude Opus 5.5 45424e6fd6 Vermietungs-Tool
A local web app for a small room-rental business in Austria: guest register,
room ledger, occupancy plan, invoices, the monthly tourist-tax report and the
quarterly VAT list. Application code only; it ships no data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 16:52:27 +01:00

24 lines
758 B
Python

"""Settings that must not live in git — database URLs. Read from the environment first, else from the
git-ignored `.env` at the repo root (KEY=VALUE lines, # comments)."""
import os
from functools import lru_cache
from pathlib import Path
ENV_FILE = Path(__file__).resolve().parents[1] / ".env"
@lru_cache(maxsize=1)
def _values():
values = {}
if ENV_FILE.exists():
for line in ENV_FILE.read_text(encoding="utf-8").splitlines():
line = line.strip()
if line and not line.startswith("#") and "=" in line:
key, value = line.split("=", 1)
values[key.strip()] = value.strip()
return values
def get(key, default=None):
return os.environ.get(key) or _values().get(key, default)