blob: a52c0437279d524c46e9f86f1d83509fe8b39098 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
package main
import (
"flag"
"log"
"time"
)
var (
port *int
)
func main() {
// parse the command line flags
parseFlags()
// periocically get the stats from all companion containers
go func() {
for {
// get stats
log.Printf("Fetching the stats")
listDockerContainers()
log.Printf("Done fetching the stats")
time.Sleep(1 * time.Second)
}
}()
// setup a http server displaying the scoreboard
log.Println("setting up the http server")
httpServer := setupHTTPServer()
// start the http server
log.Println("Starting the http server")
log.Fatalln(httpServer.ListenAndServe())
}
// parseFlags parses the command line flags
func parseFlags() {
port = flag.Int("port", 8080, "Port the http server should run on")
flag.Parse()
}
|