1
0
Fork 0

Allow HTTP listen address configuration

master 0.1.0
Timothée Floure 2 years ago
parent 4e6971b837
commit dbec2d6a05
  1. 1
      README.md
  2. 1
      config.toml.sample
  3. 4
      main.go

@ -33,6 +33,7 @@ TargetRoomID = "!jHFKHemgIAaDJekoxN:matrix-staging.ungleich.ch"
MXID = "@fnux:matrix-staging.ungleich.ch"
MXToken = "secretsecretsecret"
HTTPPort = 9088
HTTPAddress = ""
I (master|✚1) ~/W/f/matrix-alertmanager-receiver » ./matrix-alertmanager-receiver -config config.toml
2020/05/03 10:50:47 Reading configuration from config.toml.
2020/05/03 10:50:47 Connecting to Matrix Homserver https://staging.matrix.ungleich.cloud as @fnux:matrix-staging.ungleich.ch.

@ -3,3 +3,4 @@ TargetRoomID = "!jHFKHemgIAaDJekoxN:matrix-staging.ungleich.ch"
MXID = "@fnux:matrix-staging.ungleich.ch"
MXToken = "secret"
HTTPPort = 9088
HTTPAddress = ""

@ -23,7 +23,7 @@ type Configuration struct {
MXToken string
HTTPPort int
HTTPToken string
HTTPAddress string
}
func getMatrixMessageFor(alert template.Alert) gomatrix.HTMLMessage {
@ -129,7 +129,7 @@ func main() {
handleIncomingHooks(w, r, matrixClient, config.TargetRoomID)
})
var listenAddr = fmt.Sprintf(":%v", config.HTTPPort)
var listenAddr = fmt.Sprintf("%v:%v", config.HTTPAddress, config.HTTPPort)
logger.Printf("Listening for HTTP requests (webhooks) on %v", listenAddr)
logger.Fatal(http.ListenAndServe(listenAddr, nil))
}

Loading…
Cancel
Save