-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
44 lines (34 loc) · 1.61 KB
/
Copy pathconfig.py
File metadata and controls
44 lines (34 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""Configuration loaded from environment variables."""
import os
from dotenv import load_dotenv
load_dotenv()
def _require(name: str) -> str:
value = os.getenv(name)
if not value:
raise RuntimeError(f"Required environment variable '{name}' is not set. Check your .env file.")
return value
def validate() -> None:
"""Validate all required environment variables.
Must be called once at application startup, before any Twitch
connection is attempted. Raises RuntimeError if any required
variable is missing.
"""
global TWITCH_CHANNEL
TWITCH_CHANNEL = _require("TWITCH_CHANNEL")
# Optional: kept for users who still want to supply a token manually.
TWITCH_TOKEN: str | None = os.getenv("TWITCH_TOKEN")
TWITCH_CHANNEL: str = os.getenv("TWITCH_CHANNEL", "")
COMMAND_PREFIX: str = os.getenv("COMMAND_PREFIX", "!sx")
COOLDOWN: int = int(os.getenv("COOLDOWN", "5"))
DIFFICULTY: str = os.getenv("DIFFICULTY", "easy")
MODEL_PATH: str = os.getenv(
"MODEL_PATH", "models/frWac_no_postag_no_phrase_700_skip_cut50.bin"
)
OVERLAY_ENABLED: bool = os.getenv("OVERLAY_ENABLED", "false").lower() in ("1", "true", "yes")
OVERLAY_PORT: int = int(os.getenv("OVERLAY_PORT", "8080"))
# Twitch OAuth (Authorization Code flow)
TWITCH_CLIENT_ID: str | None = os.getenv("TWITCH_CLIENT_ID")
TWITCH_CLIENT_SECRET: str | None = os.getenv("TWITCH_CLIENT_SECRET")
TWITCH_REDIRECT_URI: str = os.getenv("TWITCH_REDIRECT_URI", "http://localhost:4343/callback")
TWITCH_SCOPES: str = os.getenv("TWITCH_SCOPES", "chat:read chat:edit")
TWITCH_TOKEN_PATH: str = os.getenv("TWITCH_TOKEN_PATH", ".secrets/twitch_tokens.json")