musicdlp/backend/config.py

23 lines
466 B
Python
Raw Normal View History

2024-05-03 19:57:20 +03:00
import os
from pathlib import Path
class Config:
def __init__(self) -> None:
self.host = os.getenv('HOST') or '0.0.0.0'
self.port = int(os.getenv('PORT') or 4009)
self.path_length = int(os.getenv('PATH_LENGTH') or 255)
self.cookies_dir = Path(os.getenv('COOKIES_DIR') or 'cookies')
_config: Config | None = None
def get() -> Config:
global _config
if _config is None:
_config = Config()
return _config