mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-03-28 17:43:05 +01:00
28 lines
752 B
Python
28 lines
752 B
Python
import logging
|
|
from typing import Literal
|
|
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
serial_port: str = "" # Empty string triggers auto-detection
|
|
serial_baudrate: int = 115200
|
|
log_level: Literal["DEBUG", "INFO", "WARNING", "ERROR"] = "INFO"
|
|
database_path: str = "data/meshcore.db"
|
|
max_radio_contacts: int = 200 # Max non-repeater contacts to keep on radio for DM ACKs
|
|
|
|
class Config:
|
|
env_prefix = "MESHCORE_"
|
|
|
|
|
|
settings = Settings()
|
|
|
|
|
|
def setup_logging() -> None:
|
|
"""Configure logging for the application."""
|
|
logging.basicConfig(
|
|
level=settings.log_level,
|
|
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
|
datefmt="%Y-%m-%d %H:%M:%S",
|
|
)
|