Download config.py from MoBkr/dosemate: direct link, hf CLI and curl.
- Browser
- Download file 2.28 kB
-
https://huggingface.co/spaces/MoBkr/dosemate/resolve/main/config.py
- Command line
-
hf download hf://spaces/MoBkr/dosemate/config.py
-
curl -L -o config.py https://huggingface.co/spaces/MoBkr/dosemate/resolve/main/config.py
2.28 kB
| """Central configuration for the medication-adherence layer. | |
| All values are read from environment variables (loaded via python-dotenv, | |
| the same pattern used in agents.py). Sensible dev defaults are provided so the | |
| app boots even before a full .env is filled in. | |
| Add these to your .env file: | |
| # Auth | |
| JWT_SECRET=change-me-in-production | |
| JWT_ALG=HS256 | |
| JWT_EXPIRE_MIN=43200 # 30 days | |
| # Web Push (generate once with: vapid --gen or see push_service.py) | |
| VAPID_PUBLIC_KEY= | |
| VAPID_PRIVATE_KEY= | |
| VAPID_CLAIM_EMAIL=mailto:admin@example.com | |
| # Caregiver email (Gmail app-password style) | |
| SMTP_HOST=smtp.gmail.com | |
| SMTP_PORT=587 | |
| SMTP_USER= | |
| SMTP_PASS= | |
| SMTP_FROM= | |
| # Behaviour | |
| CAREGIVER_GRACE_MIN=30 # minutes after a dose before it counts as missed | |
| FRONTEND_URL=http://localhost:5173 | |
| """ | |
| import os | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| def _int(name: str, default: int) -> int: | |
| try: | |
| return int(os.getenv(name, default)) | |
| except (TypeError, ValueError): | |
| return default | |
| # --- Auth ------------------------------------------------------------------- | |
| JWT_SECRET = os.getenv("JWT_SECRET", "dev-insecure-secret-change-me") | |
| JWT_ALG = os.getenv("JWT_ALG", "HS256") | |
| JWT_EXPIRE_MIN = _int("JWT_EXPIRE_MIN", 60 * 24 * 30) # 30 days | |
| # --- Web Push --------------------------------------------------------------- | |
| VAPID_PUBLIC_KEY = os.getenv("VAPID_PUBLIC_KEY", "") | |
| VAPID_PRIVATE_KEY = os.getenv("VAPID_PRIVATE_KEY", "") | |
| VAPID_CLAIM_EMAIL = os.getenv("VAPID_CLAIM_EMAIL", "mailto:admin@example.com") | |
| # --- Caregiver email (SMTP) ------------------------------------------------- | |
| SMTP_HOST = os.getenv("SMTP_HOST", "") | |
| SMTP_PORT = _int("SMTP_PORT", 587) | |
| SMTP_USER = os.getenv("SMTP_USER", "") | |
| SMTP_PASS = os.getenv("SMTP_PASS", "") | |
| SMTP_FROM = os.getenv("SMTP_FROM", SMTP_USER) | |
| # --- Behaviour -------------------------------------------------------------- | |
| CAREGIVER_GRACE_MIN = _int("CAREGIVER_GRACE_MIN", 30) | |
| FRONTEND_URL = os.getenv("FRONTEND_URL", "http://localhost:5173") | |
| # --- Capability flags (for the UI to show what's wired up) ------------------ | |
| PUSH_CONFIGURED = bool(VAPID_PRIVATE_KEY and VAPID_PUBLIC_KEY) | |
| EMAIL_CONFIGURED = bool(SMTP_HOST and SMTP_USER and SMTP_PASS) | |