diff --git a/main.go b/main.go index d0cb9dc..1e51bfd 100644 --- a/main.go +++ b/main.go @@ -22,6 +22,10 @@ func main() { if !ok { log.Fatalf("unable to read CONTAINER_NAME") } + listen, ok := os.LookupEnv("LISTEN") + if !ok { + listen = ":8080" + } defaultHeaders := map[string]string{"User-Agent": "engine-api-cli-1.0"} cli, err := client.NewClient("unix:///var/run/docker.sock", "v1.44", nil, defaultHeaders) @@ -38,7 +42,7 @@ func main() { go counter.Scan(logs) http.HandleFunc("/", counter.MetricsHandler) - err = http.ListenAndServe(":8080", nil) + err = http.ListenAndServe(listen, nil) log.Fatalf("unable to listen: %s", err) }