diff options
Diffstat (limited to 'src/main.go')
-rw-r--r-- | src/main.go | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/main.go b/src/main.go new file mode 100644 index 0000000..a52c043 --- /dev/null +++ b/src/main.go @@ -0,0 +1,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() +} |