diff --git a/README.md b/README.md index 015bf07..7338646 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ You can re-trigger processing by editing the file to restore the original `BLIGH ```bash # 1. Clone this repo onto the machine that will run the listener git clone -cd Blight_Reader +cd BLIGHT--CUE # 2. Create and activate a virtual environment python3 -m venv .venv @@ -83,13 +83,13 @@ cp .env.example .env Edit `.env` with your values: -| Variable | Description | -|---|---| -| `GITEA_URL` | Base URL of your Gitea instance, no trailing slash | -| `GITEA_TOKEN` | Personal access token from Gitea → Settings → Applications | +| Variable | Description | +| ---------------- | ------------------------------------------------------------------- | +| `GITEA_URL` | Base URL of your Gitea instance, no trailing slash | +| `GITEA_TOKEN` | Personal access token from Gitea → Settings → Applications | | `GEMINI_API_KEY` | API key from [Google AI Studio](https://aistudio.google.com/apikey) | -| `WEBHOOK_SECRET` | A secret string you choose — must match what you set in Gitea | -| `WEBHOOK_PORT` | Port the listener binds to (default: `5010`) | +| `WEBHOOK_SECRET` | A secret string you choose — must match what you set in Gitea | +| `WEBHOOK_PORT` | Port the listener binds to (default: `5010`) | --- @@ -125,12 +125,45 @@ WantedBy=multi-user.target ## Registering the Webhook in Gitea +### If Gitea runs in Docker + +Gitea containers cannot reach `localhost` on the host directly. The recommended approach is to use `host.docker.internal`, which Docker resolves to the host machine's IP. + +**1. Add `extra_hosts` to your Gitea `docker-compose.yml`:** + +```yaml +services: + gitea: + image: gitea/gitea:latest + # ... your existing config ... + extra_hosts: + - "host.docker.internal:host-gateway" +``` + +**2. Restart Gitea:** + +```bash +docker compose down && docker compose up -d +``` + +**3. Register the webhook using `host.docker.internal` as the host** (see below), with the Target URL set to: + +``` +http://host.docker.internal:5010/webhook +``` + +> **Note:** If Gitea is not running when CUE fires, or CUE is not running when Gitea sends a webhook, the delivery will fail. You can use the **Redeliver** button in the webhook's delivery history to retry without needing to push again. + +--- + +### Registering the Webhook + Do this for **each repository** you want BLIGHT: CUE to watch. 1. Open the repository in Gitea. 2. Go to **Settings** → **Webhooks** → **Add Webhook** → **Gitea**. 3. Set the fields: - - **Target URL**: `http://:5010/webhook` + - **Target URL**: `http://host.docker.internal:5010/webhook` (Docker) or `http://:5010/webhook` (non-Docker) - **HTTP Method**: POST - **Content Type**: `application/json` - **Secret**: the same value as `WEBHOOK_SECRET` in your `.env`