configurable listen address
This commit is contained in:
parent
4f41e275d6
commit
7492095dd1
6
main.go
6
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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue