~fnux/matrix-alertmanager-receiver

dbec2d6a052047ef5bef02e800e2b1a1d85df433 — Timothée Floure 6 months ago 4e6971b 0.1.0
Allow HTTP listen address configuration
3 files changed, 4 insertions(+), 2 deletions(-)

M README.md
M config.toml.sample
M main.go
M README.md => README.md +1 -0
@@ 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.

M config.toml.sample => config.toml.sample +1 -0
@@ 3,3 3,4 @@ TargetRoomID = "!jHFKHemgIAaDJekoxN:matrix-staging.ungleich.ch"
MXID = "@fnux:matrix-staging.ungleich.ch"
MXToken = "secret"
HTTPPort = 9088
HTTPAddress = ""

M main.go => main.go +2 -2
@@ 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))
}