34 lines
1.3 KiB
Python
34 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
import os
|
|
from dataclasses import dataclass
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
|
|
load_dotenv()
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class Config:
|
|
database_url: str = os.getenv(
|
|
"DATABASE_URL",
|
|
"mysql+pymysql://switchbot:switchbot_password@localhost:3306/switchbot",
|
|
)
|
|
switchbot_token: str | None = os.getenv("SWITCHBOT_TOKEN")
|
|
switchbot_secret: str | None = os.getenv("SWITCHBOT_SECRET")
|
|
collect_interval_seconds: int = int(os.getenv("COLLECT_INTERVAL_SECONDS", "900"))
|
|
app_timezone: str = os.getenv("APP_TIMEZONE", "Europe/London")
|
|
flask_secret_key: str = os.getenv("FLASK_SECRET_KEY", "dev-only-secret")
|
|
healthcheck_url: str | None = os.getenv("HEALTHCHECK_URL")
|
|
report_output_dir: str = os.getenv("REPORT_OUTPUT_DIR", "/tmp/switchbot-reports")
|
|
report_sender_email: str = os.getenv("REPORT_SENDER_EMAIL", "")
|
|
report_sender_name: str = os.getenv("REPORT_SENDER_NAME", "SwitchBot Temps")
|
|
smtp2go_api_key: str = os.getenv("SMTP2GO_API_KEY", "")
|
|
smtp2go_api_url: str = os.getenv("SMTP2GO_API_URL", "https://api.smtp2go.com/v3/email/send")
|
|
smtp2go_timeout_seconds: int = int(os.getenv("SMTP2GO_TIMEOUT_SECONDS", "20"))
|
|
report_scheduler_poll_seconds: int = int(os.getenv("REPORT_SCHEDULER_POLL_SECONDS", "300"))
|
|
|
|
|
|
config = Config()
|