-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
45 lines (38 loc) · 787 Bytes
/
Copy pathmain.go
File metadata and controls
45 lines (38 loc) · 787 Bytes
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
43
44
45
package main
import (
"flag"
"go_gateway/common/lib"
"go_gateway/initialize"
"go_gateway/router"
"os"
"os/signal"
"syscall"
)
var (
endpoint = flag.String("endpoint", "dashboard", "input endpoint dashboard or server")
config = flag.String("config", "./conf/dev/", "input config file like ./conf/dev/")
)
func main() {
flag.Parse()
if *endpoint == "" {
flag.Usage()
os.Exit(1)
}
if *config == "" {
flag.Usage()
os.Exit(1)
}
if *endpoint == "dashboard" {
err := lib.InitModule("./conf/dev/")
if err != nil {
panic(err)
}
defer lib.Destroy()
initialize.Init()
router.HttpServerRun()
quit := make(chan os.Signal)
signal.Notify(quit, syscall.SIGKILL, syscall.SIGQUIT, syscall.SIGINT, syscall.SIGTERM)
<-quit
router.HttpServerStop()
}
}