Files
Vox/config.py
Spencer 9917d44f5d docs: add HuggingFace cache troubleshooting to README
- Document HF_HOME environment variable for writable cache
- Add systemd service permission guidance for /tmp paths
- Troubleshooting steps for read-only file system errors
2026-02-26 15:56:09 -06:00

27 lines
945 B
Python
Executable File

import os
from dotenv import load_dotenv
# Load appropriate .env file based on ENV_MODE
env_mode = os.getenv("ENV_MODE", "production")
env_file = ".env.testing" if env_mode == "testing" else ".env"
load_dotenv(env_file)
class Config:
DISCORD_TOKEN: str = os.getenv("DISCORD_TOKEN", "")
TEXT_CHANNEL_ID: int = int(os.getenv("TEXT_CHANNEL_ID", "0"))
VOICES_DIR: str = os.getenv("VOICES_DIR", "./voices")
DEFAULT_VOICE: str | None = os.getenv("DEFAULT_VOICE", None)
@classmethod
def validate(cls) -> list[str]:
"""Validate configuration and return list of errors."""
errors = []
if not cls.DISCORD_TOKEN:
errors.append("DISCORD_TOKEN is not set")
if cls.TEXT_CHANNEL_ID == 0:
errors.append("TEXT_CHANNEL_ID is not set")
if not os.path.exists(cls.VOICES_DIR):
errors.append(f"Voices directory not found: {cls.VOICES_DIR}")
return errors