Add a Matrix example to notifications.md

Why: I spent a few hours to get it setup right as I didn't understand what shoutrr was. This might help others as well in the future. Example: https://lemmy.world/comment/928893
This commit is contained in:
Krafting 2023-07-08 11:34:47 +02:00 committed by GitHub
parent 787ce72ffd
commit 30e35f38cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -45,6 +45,24 @@ Simple templates are used unless the `notification-report` flag is specified:
- `--notification-report` (env. `WATCHTOWER_NOTIFICATION_REPORT`): Use the session report as the notification template data.
### Matrix Template
To send notifications via matrix, the following command-line options, or their corresponding environment variables, should be set:
- `--notification-url` (env. `WATCHTOWER_NOTIFICATION_URL`): The matrix service URL to be used.
- `--notification-template` (env. `WATCHTOWER_NOTIFICATION_TEMPLATE`): The format to be used for notifications.
Example:
```bash
docker run -d \
--name watchtower \
-v /var/run/docker.sock:/var/run/docker.sock \
-e WATCHTOWER_NOTIFICATION_URL=matrix://username:password@domain.org/?rooms=!ROOMID:domain.org \
-e WATCHTOWER_NOTIFICATION_TEMPLATE="{{range .}}[WatchTower] ({{.Level}}): {{.Message}}{{println}}{{end}}" \
containrrr/watchtower
```
## Simple templates
The default value if not set is `{{range .}}{{.Message}}{{println}}{{end}}`. The example below uses a template that also