Hardcoded ALLOWED_OWNER="euphon" blocked non-euphon repos from being processed. Move it to config.yaml as a list so each deployment can specify its own allowed owners. Also make git user.name/email configurable for multi-instance deployments (e.g. ms vs yoyo).
26 lines
1.0 KiB
Python
26 lines
1.0 KiB
Python
from pathlib import Path
|
|
import yaml
|
|
|
|
_cfg_path = Path(__file__).parent / "config.yaml"
|
|
_cfg = yaml.safe_load(_cfg_path.read_text())
|
|
|
|
# Gitea
|
|
GITEA_URL: str = _cfg["gitea"]["url"]
|
|
GITEA_TOKEN: str = _cfg["gitea"]["token"]
|
|
WEBHOOK_SECRET: str = _cfg["gitea"].get("webhook_secret", "")
|
|
|
|
# Bot
|
|
BOT_USERNAME: str = _cfg["bot"]["username"]
|
|
LISTEN_PORT: int = _cfg["bot"].get("listen_port", 9880)
|
|
WORKSPACE_DIR: Path = Path(_cfg["bot"].get("workspace_dir", "/data/src/gitea-bot/workspaces"))
|
|
BOT_GIT_NAME: str = _cfg["bot"].get("git_name", BOT_USERNAME)
|
|
BOT_GIT_EMAIL: str = _cfg["bot"].get("git_email", f"{BOT_USERNAME}@euphon.net")
|
|
ALLOWED_OWNERS: list[str] = _cfg["bot"].get("allowed_owners", [])
|
|
|
|
# Claude
|
|
CLAUDE_COMMAND: str = _cfg["claude"]["command"]
|
|
CLAUDE_ARGS: list[str] = _cfg["claude"].get("args", ["-p", "--output-format", "text"])
|
|
CLAUDE_MODEL: str = _cfg["claude"].get("model", "sonnet")
|
|
CLAUDE_MAX_TURNS: int = _cfg["claude"].get("max_turns", 30)
|
|
CLAUDE_SYSTEM_PROMPT: str = _cfg["claude"].get("system_prompt", "You are a helpful bot.")
|