obsws-cli/obsws_cli/settings.py
onyx-and-iris 81762508a7 add env var and defaults to --help
move Settings into settings module

patch bump
2025-05-19 01:42:59 +01:00

32 lines
715 B
Python

"""module for settings management."""
from pathlib import Path
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
"""Settings for the OBS WebSocket client."""
model_config = SettingsConfigDict(
env_file=(
'.env',
Path.home() / '.config' / 'obsws-cli' / 'obsws.env',
),
env_file_encoding='utf-8',
env_prefix='OBS_',
)
HOST: str = 'localhost'
PORT: int = 4455
PASSWORD: str = '' # No password by default
TIMEOUT: int = 5 # Timeout for requests in seconds
_settings = Settings().model_dump()
def get(key: str) -> str:
"""Get a setting by key."""
return _settings.get(key)