Add Gitea Event Bridge application files

This commit is contained in:
hitanshu 2026-04-07 21:46:58 +00:00
parent 9dca5fd0b4
commit 7e24fc26a3

45
config.py Normal file
View File

@ -0,0 +1,45 @@
"""Configuration settings for Gitea Event Bridge."""
import os
from dotenv import load_dotenv
load_dotenv()
# OpenCode Server Configuration
OPENCODE_URL = os.getenv("OPENCODE_URL", "http://localhost:8080")
# Flask Configuration
HOST = os.getenv("HOST", "0.0.0.0")
PORT = int(os.getenv("PORT", "5000"))
DEBUG = os.getenv("DEBUG", "false").lower() == "true"
# Activity Log Configuration (JSON Lines format)
LOG_FILE = os.getenv("LOG_FILE", "activity.json")
# Ensure LOG_FILE is absolute path if set via environment
if LOG_FILE and not LOG_FILE.startswith('/'):
import os
LOG_FILE = os.path.abspath(LOG_FILE)
# Gitea Webhook Configuration
GITEA_WEBHOOK_SECRET = os.getenv("GITEA_WEBHOOK_SECRET", "")
# Auto-Trigger Configuration
AUTO_TRIGGER_PIPELINE = os.getenv("AUTO_TRIGGER_PIPELINE", "true").lower() == "true"
AUTO_TRIGGER_REVIEW = os.getenv("AUTO_TRIGGER_REVIEW", "true").lower() == "true"
# Supported Gitea Events
GITEA_EVENT_TYPES = [
"issue",
"issue.label",
"pull_request",
"pull_request.label",
"pull_request.review",
"comment",
"repository",
"organization"
]
# SSE Configuration
SSE_RECONNECT_TIME = 5
SSE_HEARTBEAT_INTERVAL = 30