diff --git a/Dockerfile b/Dockerfile index 40261b6..c144f73 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,6 @@ RUN adduser -D -g '' xmpp-webhook USER xmpp-webhook ENV XMPP_ID="" \ XMPP_PASS="" \ - XMPP_RECEIVERS="" + XMPP_RECIPIENTS="" EXPOSE 4321 CMD ["/xmpp-webhook"] diff --git a/README.md b/README.md index 18647dd..a1c7d70 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Check https://github.com/tmsmr/xmpp-webhook/blob/master/parser/ to learn how to - `xmpp-webhook` is configured via environment variables: - `XMPP_ID` - The JID we want to use - `XMPP_PASS` - The password - - `XMPP_RECEIVERS` - Comma-seperated list of JID's + - `XMPP_RECIPIENTS` - Comma-seperated list of JID's - `XMPP_SKIP_VERIFY` - Skip TLS verification (Optional) - `XMPP_OVER_TLS` - Use dedicated TLS port (Optional) - `XMPP_WEBHOOK_LISTEN_ADDRESS` - Bind address (Optional) @@ -26,14 +26,14 @@ curl -X POST -d @dev/grafana-webhook-alert-example.json localhost:4321/grafana curl -X POST -d @dev/alertmanager-example.json localhost:4321/alertmanager curl -X POST -d @dev/slack-compatible-notification-example.json localhost:4321/slack ``` -- After parsing the body in the appropriate `parserFunc`, the notification is then distributed to the configured receivers. +- After parsing the body in the appropriate `parserFunc`, the notification is then distributed to the configured recipients. ## Run with Docker ### Build it - Build image: `docker build -t xmpp-webhook .` -- Run: `docker run -e "XMPP_ID=alerts@example.org" -e "XMPP_PASS=xxx" -e "XMPP_RECEIVERS=receiver1@example.org,receiver2@example.org" -p 4321:4321 -d --name xmpp-webhook xmpp-webhook` +- Run: `docker run -e "XMPP_ID=alerts@example.org" -e "XMPP_PASS=xxx" -e "XMPP_RECIPIENTS=a@example.org,b@example.org" -p 4321:4321 -d --name xmpp-webhook xmpp-webhook` ### Use prebuilt image from Docker Hub -- Run: `docker run -e "XMPP_ID=alerts@example.org" -e "XMPP_PASS=xxx" -e "XMPP_RECEIVERS=receiver1@example.org,receiver2@example.org" -p 4321:4321 -d --name xmpp-webhook tmsmr/xmpp-webhook:latest` +- Run: `docker run -e "XMPP_ID=alerts@example.org" -e "XMPP_PASS=xxx" -e "XMPP_RECIPIENTS=a@example.org,b@example.org" -p 4321:4321 -d --name xmpp-webhook tmsmr/xmpp-webhook:latest` ## Installation - Download and extract the latest tarball (GitHub release page) @@ -44,7 +44,7 @@ curl -X POST -d @dev/slack-compatible-notification-example.json localhost:4321/s ``` XMPP_ID='bot@example.com' XMPP_PASS='passw0rd' -XMPP_RECEIVERS='jdoe@example.com,ops@example.com' +XMPP_RECIPIENTS='jdoe@example.com,ops@example.com' ``` - Enable and start the service: diff --git a/main.go b/main.go index 72aa8fa..300ca31 100644 --- a/main.go +++ b/main.go @@ -72,10 +72,10 @@ func closeXMPP(session *xmpp.Session) { } func main() { - // get xmpp credentials, message receivers + // get xmpp credentials, message recipients xi := os.Getenv("XMPP_ID") xp := os.Getenv("XMPP_PASS") - xr := os.Getenv("XMPP_RECEIVERS") + xr := os.Getenv("XMPP_RECIPIENTS") // get tls settings from env _, skipTLSVerify := os.LookupEnv("XMPP_SKIP_VERIFY") @@ -87,9 +87,9 @@ func main() { listenAddress = ":4321" } - // check if xmpp credentials and receiver list are supplied + // check if xmpp credentials and recipient list are supplied if xi == "" || xp == "" || xr == "" { - log.Fatal("XMPP_ID, XMPP_PASS or XMPP_RECEIVERS not set") + log.Fatal("XMPP_ID, XMPP_PASS or XMPP_RECIPIENTS not set") } myjid, err := jid.Parse(xi) @@ -147,7 +147,7 @@ func main() { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - // wait for messages from the webhooks and send them to all receivers + // wait for messages from the webhooks and send them to all recipients go func() { for m := range messages { for _, r := range strings.Split(xr, ",") {