| 29 | ) |
| 30 | |
| 31 | func main() { |
| 32 | app := cli.NewApp() |
| 33 | app.Name = "IceFireDB-PubSub" |
| 34 | app.Description = "IceFireDB-PubSub, easier to use P2P Events, support resp protocol." |
| 35 | app.Flags = []cli.Flag{ |
| 36 | cli.StringFlag{ |
| 37 | Name: "config,c", |
| 38 | Usage: "config file", |
| 39 | Required: false, |
| 40 | Value: "config/config.yaml", |
| 41 | }, |
| 42 | } |
| 43 | app.Before = initConfig |
| 44 | app.Action = start |
| 45 | err := app.Run(os.Args) |
| 46 | if err != nil { |
| 47 | logrus.Errorf("failed to run application: %v", err) |
| 48 | os.Exit(1) |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | func start(c *cli.Context) error { |
| 53 | ctx, cancel := context.WithCancel(context.Background()) |