kopia lustrzana https://github.com/tmsmr/xmpp-webhook
Make listen address configurable
rodzic
34d3730325
commit
d4afef63f1
|
@ -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_RECEIVERS` - Comma-seperated list of JID's
|
||||||
- `XMPP_SKIP_VERIFY` - Skip TLS verification (Optional)
|
- `XMPP_SKIP_VERIFY` - Skip TLS verification (Optional)
|
||||||
- `XMPP_OVER_TLS` - Use dedicated TLS port (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.:
|
- After startup, `xmpp-webhook` tries to connect to the XMPP server and provides the implemented HTTP enpoints (on `:4321`). e.g.:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
8
main.go
8
main.go
|
@ -75,6 +75,12 @@ func main() {
|
||||||
_, skipTLSVerify := os.LookupEnv("XMPP_SKIP_VERIFY")
|
_, skipTLSVerify := os.LookupEnv("XMPP_SKIP_VERIFY")
|
||||||
_, useXMPPS := os.LookupEnv("XMPP_OVER_TLS")
|
_, 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
|
// check if xmpp credentials and receiver list are supplied
|
||||||
if xi == "" || xp == "" || xr == "" {
|
if xi == "" || xp == "" || xr == "" {
|
||||||
log.Fatal("XMPP_ID, XMPP_PASS or XMPP_RECEIVERS not set")
|
log.Fatal("XMPP_ID, XMPP_PASS or XMPP_RECEIVERS not set")
|
||||||
|
@ -156,5 +162,5 @@ func main() {
|
||||||
http.Handle("/slack", newMessageHandler(messages, parser.SlackParserFunc))
|
http.Handle("/slack", newMessageHandler(messages, parser.SlackParserFunc))
|
||||||
|
|
||||||
// listen for requests
|
// listen for requests
|
||||||
_ = http.ListenAndServe(":4321", nil)
|
_ = http.ListenAndServe(listenAddress, nil)
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue