forked from cloudfoundry-incubator/pat
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.go
37 lines (32 loc) · 780 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
package main
import (
"fmt"
"os"
"github.com/cloudfoundry-incubator/pat/cmdline"
"github.com/cloudfoundry-incubator/pat/config"
"github.com/cloudfoundry-incubator/pat/logs"
"github.com/cloudfoundry-incubator/pat/server"
)
func main() {
useServer := false
flags := config.ConfigAndFlags
flags.BoolVar(&useServer, "server", false, "true to run the HTTP server interface")
logs.InitCommandLineFlags(flags)
cmdline.InitCommandLineFlags(flags)
server.InitCommandLineFlags(flags)
err := flags.Parse(os.Args[1:])
if err != nil {
fmt.Println(err)
os.Exit(10)
}
if useServer == true {
logs.NewLogger("main").Info("Starting in server mode")
server.Serve()
} else {
err = cmdline.RunCommandLine()
if err != nil {
fmt.Println(err)
os.Exit(20)
}
}
}