diff --git a/README.md b/README.md index b2a456d..49a8134 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Check https://github.com/tmsmr/xmpp-webhook/blob/master/parser/ to learn how to - `XMPP_RECEIVERS` - 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) - After startup, `xmpp-webhook` tries to connect to the XMPP server and provides the implemented HTTP enpoints (on `:4321`). e.g.: ``` diff --git a/main.go b/main.go index bc9633c..61a21a7 100644 --- a/main.go +++ b/main.go @@ -75,6 +75,12 @@ func main() { _, skipTLSVerify := os.LookupEnv("XMPP_SKIP_VERIFY") _, useXMPPS := os.LookupEnv("XMPP_OVER_TLS") + // get listen address + listenAddress := os.Getenv("XMPP_WEBHOOK_LISTEN_ADDRESS") + if len(listenAddress) == 0 { + listenAddress = ":4321" + } + // check if xmpp credentials and receiver list are supplied if xi == "" || xp == "" || xr == "" { log.Fatal("XMPP_ID, XMPP_PASS or XMPP_RECEIVERS not set") @@ -157,5 +163,5 @@ func main() { http.Handle("/alertmanager", newMessageHandler(messages, parser.AlertmanagerParserFunc)) // listen for requests - _ = http.ListenAndServe(":4321", nil) + _ = http.ListenAndServe(listenAddress, nil) }