Skip to content

Commit

Permalink
docs: tweak readme running instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Jan 30, 2025
1 parent 26c64e1 commit d0a7535
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Call a remote API on ODK Central database events:
- Update entity (entity properties).
- Submission review (approved, hasIssues, rejected).

The `centralwebhook` binary is small ~15Mb and only consumes
~5Mb of memory when running.

## Prerequisites

- ODK Central running, connecting to an accessible Postgresql database.
Expand All @@ -17,25 +20,24 @@ Call a remote API on ODK Central database events:
The `centralwebhook` tool is a service that runs continually, monitoring the
ODK Central database for updates and triggering the webhook as appropriate.

### Integrate Into ODK Central Stack
### Integrate Into [ODK Central](https://github.com/getodk/central) Stack

- It's possible to include this as part of the standard ODK Central docker
compose stack.
- First add the environment variables to your `.env` file:

```dotenv
CENTRAL_WEBHOOK_DB_URI=postgresql://user:pass@localhost:5432/db_name?sslmode=disable
CENTRAL_WEBHOOK_UPDATE_ENTITY_URL=https://your.domain.com/some/webhook
CENTRAL_WEBHOOK_REVIEW_SUBMISSION_URL=https://your.domain.com/some/webhook
CENTRAL_WEBHOOK_NEW_SUBMISSION_URL=https://your.domain.com/some/webhook
CENTRAL_WEBHOOK_API_KEY=ksdhfiushfiosehf98e3hrih39r8hy439rh389r3hy983y
```
```dotenv
CENTRAL_WEBHOOK_UPDATE_ENTITY_URL=https://your.domain.com/some/webhook
CENTRAL_WEBHOOK_REVIEW_SUBMISSION_URL=https://your.domain.com/some/webhook
CENTRAL_WEBHOOK_NEW_SUBMISSION_URL=https://your.domain.com/some/webhook
CENTRAL_WEBHOOK_API_KEY=your_api_key_key
```
> [!TIP]
> Omit a xxx_URL variable if you do not wish to use that particular webhook.
>
> The CENTRAL_WEBHOOK_API_KEY variable is also optional, see
> [#apis-with-authentication]
> [!TIP]
> Omit a xxx_URL variable if you do not wish to use that particular webhook.
>
> The CENTRAL_WEBHOOK_API_KEY variable is also optional, see the
> [APIs With Authentication](#apis-with-authentication) section.
- Then extend the docker compose configuration at startup:
Expand Down Expand Up @@ -90,7 +92,6 @@ Then run with:
-reviewSubmissionUrl 'https://your.domain.com/some/webhook'
```

> [!TIP]
> It's possible to specify a single webhook event, or multiple.
</details>
Expand Down Expand Up @@ -136,7 +137,6 @@ if err != nil {
}
```

> [!NOTE]
> To not provide a webhook for an event, pass `nil` as the url.
</details>
Expand Down

0 comments on commit d0a7535

Please sign in to comment.