From 7e24fc26a3c99019fd3ddd35b06dcfec4e0db8a1 Mon Sep 17 00:00:00 2001 From: hitanshu Date: Tue, 7 Apr 2026 21:46:58 +0000 Subject: [PATCH] Add Gitea Event Bridge application files --- config.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 config.py diff --git a/config.py b/config.py new file mode 100644 index 0000000..fac7be4 --- /dev/null +++ b/config.py @@ -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 \ No newline at end of file