From 30e35f38cff4068368116ffbf9997c94404ccb10 Mon Sep 17 00:00:00 2001 From: Krafting <36538123+Krafting@users.noreply.github.com> Date: Sat, 8 Jul 2023 11:34:47 +0200 Subject: [PATCH] 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 --- docs/notifications.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/notifications.md b/docs/notifications.md index 835df44..09eb1d7 100644 --- a/docs/notifications.md +++ b/docs/notifications.md @@ -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