Files
homeschool/backend/app/config.py
derekc 090ebc109e Add Ntfy push notifications for super admin events
Sends alerts to a configurable Ntfy topic on: new user registration,
account lockout after 5 failed login attempts, and login attempts on an
already-locked account. Fire-and-forget — never raises if Ntfy is down.

Configure via NTFY_URL and NTFY_TOKEN in .env.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-22 01:04:12 -07:00

29 lines
829 B
Python

from pydantic_settings import BaseSettings
from functools import lru_cache
class Settings(BaseSettings):
database_url: str
secret_key: str
algorithm: str = "HS256"
access_token_expire_minutes: int = 30
refresh_token_expire_days: int = 30
cors_origins: str = "http://localhost:8054"
admin_username: str = "admin"
admin_password: str # no default — must be explicitly set in .env
docs_enabled: bool = False
ntfy_url: str = "" # e.g. https://ntfy.sh/your-secret-topic
ntfy_token: str = "" # optional Bearer token if topic is protected
@property
def cors_origins_list(self) -> list[str]:
return [o.strip() for o in self.cors_origins.split(",")]
class Config:
env_file = ".env"
@lru_cache
def get_settings() -> Settings:
return Settings()