35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
import os
|
|
from dataclasses import dataclass
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class Settings:
|
|
app_name: str = "TradingView Alert Dispatcher"
|
|
host: str = "0.0.0.0"
|
|
port: int = 8000
|
|
database_path: str = "data/dispatcher.db"
|
|
admin_username: str = "admin"
|
|
admin_password: str = "change-me-now"
|
|
session_secret: str = "change-this-session-secret"
|
|
retention_days: int = 30
|
|
max_delivery_attempts: int = 3
|
|
retry_backoff_seconds: int = 60
|
|
feishu_timeout_seconds: int = 10
|
|
|
|
|
|
def get_settings() -> Settings:
|
|
return Settings(
|
|
host=os.getenv("APP_HOST", "0.0.0.0"),
|
|
port=int(os.getenv("APP_PORT", "8000")),
|
|
database_path=os.getenv("DATABASE_PATH", "data/dispatcher.db"),
|
|
admin_username=os.getenv("ADMIN_USERNAME", "admin"),
|
|
admin_password=os.getenv("ADMIN_PASSWORD", "change-me-now"),
|
|
session_secret=os.getenv("SESSION_SECRET", "change-this-session-secret"),
|
|
retention_days=int(os.getenv("RETENTION_DAYS", "30")),
|
|
max_delivery_attempts=int(os.getenv("MAX_DELIVERY_ATTEMPTS", "3")),
|
|
retry_backoff_seconds=int(os.getenv("RETRY_BACKOFF_SECONDS", "60")),
|
|
feishu_timeout_seconds=int(os.getenv("FEISHU_TIMEOUT_SECONDS", "10")),
|
|
)
|