Skip to content

Commit

Permalink
feat: Adds ability to override listen port
Browse files Browse the repository at this point in the history
  • Loading branch information
jmriebold committed Feb 22, 2022
1 parent a9fa7d0 commit 14fc340
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,18 @@ func main() {
}
queueUrls := strings.Split(queueVar, ",")

log.Info().Int("interval", int(monitorInterval)).Strs("queueUrls", queueUrls).Msg("Starting queue monitors")
port, portSet := os.LookupEnv("PORT")
if !portSet || port == "" {
port = "8080"
}

log.Info().Int("interval", int(monitorInterval)).Strs("queueUrls", queueUrls).Str("port", port).Msg("Starting queue monitors")

go monitorQueues(queueUrls)

http.Handle("/metrics", promhttp.Handler())
http.HandleFunc("/healthz", healthcheck)
err := http.ListenAndServe(":8080", nil)
err := http.ListenAndServe(":" + port, nil)
if err != nil {
log.Error().Str("errorMessage", err.Error()).Msg("Could not start http listener")
os.Exit(1)
Expand Down

0 comments on commit 14fc340

Please sign in to comment.