36 lines
1.3 KiB
Python
36 lines
1.3 KiB
Python
"""# Summary
|
|
|
|
App configuration loaded from environment — a Settings dataclass with defaults
|
|
plus a singleton settings instance populated from OS environment variables at
|
|
import time.
|
|
"""
|
|
import os
|
|
from dataclasses import dataclass
|
|
|
|
|
|
@dataclass
|
|
class Settings:
|
|
"""Runtime configuration settings for the application.
|
|
|
|
Attributes:
|
|
debug (bool): Enable debug behavior. Defaults to False.
|
|
mongo_uri (str): MongoDB connection URI. Defaults to mongodb://localhost:27017.
|
|
mongo_db (str): MongoDB database name. Defaults to app_template.
|
|
worker_poll_seconds (int): Worker poll interval in seconds. Defaults to 30.
|
|
worker_max_retries (int): Maximum job retries before skipping. Defaults to 3.
|
|
"""
|
|
|
|
debug: bool = False
|
|
mongo_uri: str = "mongodb://localhost:27017"
|
|
mongo_db: str = "app_template"
|
|
worker_poll_seconds: int = 30
|
|
worker_max_retries: int = 3
|
|
|
|
|
|
settings = Settings(
|
|
debug=os.environ.get("DEBUG", "").lower() in ("1", "true", "yes"),
|
|
mongo_uri=os.environ.get("MONGO_URI", "mongodb://localhost:27017"),
|
|
mongo_db=os.environ.get("MONGO_DB", "app_template"),
|
|
worker_poll_seconds=int(os.environ.get("WORKER_POLL_SECONDS", "30")),
|
|
worker_max_retries=int(os.environ.get("WORKER_MAX_RETRIES", "3")),
|
|
) |