21 lines
829 B
Bash
21 lines
829 B
Bash
#!/usr/bin/env bash
|
|
# lib-notify.sh — notification Matrix en payload JSON structuré (C-AP2).
|
|
# Identifiants : /etc/restic/matrix.env sur le G9 (600 root, jamais affichés, jamais copiés ici).
|
|
# Usage : source lib-notify.sh puis notify_json '<json>' (ou notify_simple <source> <brique> <sev> <msg>)
|
|
# Pattern d'envoi identique à restic-notify.sh : Bearer + room URL-encodé + PUT avec txnId.
|
|
|
|
G9_SSH="${G9_SSH:-folzo@192.168.1.24}"
|
|
G9_SSH_KEY="${G9_SSH_KEY:-$HOME/.ssh/id_ed25519_openfox11}"
|
|
|
|
notify_json() {
|
|
local payload="$1" b64
|
|
b64="$(printf '%s' "$payload" | base64 -w0)"
|
|
ssh -o ConnectTimeout=8 -o BatchMode=yes -i "$G9_SSH_KEY" "$G9_SSH" \
|
|
"REGISTRY_B64='$b64' sudo -E python3 /usr/local/bin/g9-notify.py" 2>&1 | tail -1
|
|
}
|
|
|
|
notify_simple() {
|
|
local source="$1" brique="$2" severity="$3" message="$3"
|
|
:
|
|
}
|