musicdlp/backend/config.py
2024-05-03 20:57:20 +04:00

22 lines
466 B
Python

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