feat(api): API Server + Discord Bot 구현 #task-191
This commit is contained in:
36
config.py
Normal file
36
config.py
Normal file
@@ -0,0 +1,36 @@
|
||||
"""Variet Agent 설정 관리.
|
||||
|
||||
.env 파일에서 환경변수를 로드합니다.
|
||||
"""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
# .env 파일 수동 파싱 (python-dotenv 없이도 동작)
|
||||
_env_path = Path(__file__).parent / ".env"
|
||||
if _env_path.exists():
|
||||
for line in _env_path.read_text(encoding="utf-8").splitlines():
|
||||
line = line.strip()
|
||||
if not line or line.startswith("#"):
|
||||
continue
|
||||
if "=" in line:
|
||||
key, _, value = line.partition("=")
|
||||
os.environ.setdefault(key.strip(), value.strip())
|
||||
|
||||
|
||||
# === Discord ===
|
||||
DISCORD_BOT_TOKEN: str = os.getenv("DISCORD_BOT_TOKEN", "")
|
||||
DISCORD_COMMAND_PREFIX: str = os.getenv("DISCORD_COMMAND_PREFIX", "!")
|
||||
|
||||
# === API Server ===
|
||||
API_HOST: str = os.getenv("API_HOST", "0.0.0.0")
|
||||
API_PORT: int = int(os.getenv("API_PORT", "8000"))
|
||||
|
||||
# === Paths ===
|
||||
PROJECT_ROOT: Path = Path(__file__).parent
|
||||
SESSIONS_DIR: Path = PROJECT_ROOT / "sessions"
|
||||
SESSIONS_DIR.mkdir(exist_ok=True)
|
||||
|
||||
# === Gemini ===
|
||||
GEMINI_TOKEN_BUDGET: int = int(os.getenv("GEMINI_TOKEN_BUDGET", "50000"))
|
||||
GEMINI_TIMEOUT: int = int(os.getenv("GEMINI_TIMEOUT", "180"))
|
||||
Reference in New Issue
Block a user