gitea-bot/config.py
Fam Zheng b701d7ceec
Some checks are pending
CI / check (push) Waiting to run
add auto_respond_new_issues option to skip @mention requirement
When enabled, the bot responds to all new issues without needing to
be explicitly @mentioned. Useful for deployments where the bot should
proactively handle every incoming issue.
2026-04-07 22:49:14 +01:00

27 lines
1.1 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", [])
AUTO_RESPOND_NEW_ISSUES: bool = _cfg["bot"].get("auto_respond_new_issues", False)
# 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.")