MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / main

Function main

IceFireDB-SQLite/main.go:18–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16)
17
18func main() {
19 app := cli.NewApp()
20
21 app.Name = "github.com/IceFireDB/IceFireDB/IceFireDB-SQLite"
22
23 app.Flags = []cli.Flag{
24 cli.StringFlag{
25 Name: "config, c",
26 Usage: "config file path",
27 Value: "config/config.yaml",
28 Required: false,
29 },
30 cli.StringFlag{
31 Name: "log,l",
32 Usage: "log level: debug,info,warning,error",
33 Value: "info",
34 },
35 }
36
37 app.Before = func(c *cli.Context) error {
38 log.SetFlags(log.Llongfile)
39 // init log
40 lv, err := logrus.ParseLevel(c.String("log"))
41 if err != nil {
42 return err
43 }
44 logrus.SetLevel(lv)
45 // init config
46 confPath := c.String("config")
47 config.InitConfig(confPath)
48 return nil
49 }
50
51 app.Action = func(c *cli.Context) error {
52 ctx, cancel := context.WithCancel(context.Background())
53 stop := make(chan struct{})
54
55 go func() {
56 ms := mysql.NewMysqlProxy()
57 ms.Run(ctx)
58 stop <- struct{}{}
59 }()
60
61 return exitSignal(cancel, stop)
62 }
63 err := app.Run(os.Args)
64 if err != nil {
65 panic(err)
66 }
67}
68
69func exitSignal(cancel context.CancelFunc, stop chan struct{}) error {
70 sigs := make(chan os.Signal, 1)

Callers

nothing calls this directly

Calls 5

InitConfigFunction · 0.92
NewMysqlProxyFunction · 0.92
exitSignalFunction · 0.70
StringMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected