forked from docker/dockercraft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
38 lines (29 loc) · 810 Bytes
/
main.go
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
package main
import (
"flag"
log "github.com/Sirupsen/logrus"
"os"
)
// The main purpose of this application is to connect the docker daemon
// (remote API) and the custom Minecraft server (cubrite using lua scripts).
// Docker daemons events are transmitted to the LUA script as JSON messages
// over TCP transport. The cuberite LUA scripts can also contact this
// application over the same TCP connection.
var debugFlag = flag.Bool("debug", false, "enable debug logging")
func main() {
flag.Parse()
if *debugFlag {
log.SetLevel(log.DebugLevel)
}
daemon := NewDaemon()
if err := daemon.Init(); err != nil {
log.Fatal(err.Error())
os.Exit(1)
}
if err := daemon.GetDockerBinary(); err != nil {
log.Fatal(err.Error())
os.Exit(1)
}
daemon.StartMonitoringEvents()
daemon.Serve()
}