diff --git a/requirements.txt b/requirements.txt index be21ad7..6f985ec 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,5 @@ msgpack lz4 websockets pydantic -aiosqlite \ No newline at end of file +aiosqlite +python-dotenv \ No newline at end of file diff --git a/src/common/config.py b/src/common/config.py index f05bab4..9f4cbbc 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -1,22 +1,8 @@ import os from pathlib import Path +from dotenv import load_dotenv -def _load_dotenv(): - env_path = Path(".env") - if not env_path.is_file(): - return - with open(env_path, encoding="utf-8") as f: - for line in f: - line = line.strip() - if not line or line.startswith("#") or "=" not in line: - continue - key, _, value = line.partition("=") - key = key.strip() - value = value.strip().strip("\"'") - if key and key not in os.environ: - os.environ[key] = value - -_load_dotenv() +load_dotenv() class ServerConfig: def __init__(self):