github.com/ztalab/ZACA@v0.0.1/main.go (about) 1 package main 2 3 import ( 4 "context" 5 "github.com/urfave/cli" 6 "github.com/ztalab/ZACA/cmd" 7 "github.com/ztalab/ZACA/initer" 8 "github.com/ztalab/ZACA/pkg/logger" 9 "os" 10 ) 11 12 func main() { 13 ctx := context.Background() 14 15 app := cli.NewApp() 16 app.Name = "capitalizone" 17 app.Version = "1.0.0" 18 app.Usage = "capitalizone" 19 app.Commands = []cli.Command{ 20 newApiCmd(ctx), 21 newTlsCmd(ctx), 22 newOcspCmd(ctx), 23 } 24 app.Before = initer.Init 25 err := app.Run(os.Args) 26 if err != nil { 27 logger.Named("Init").Errorf(err.Error()) 28 } 29 } 30 31 // newApiCmd Running API services 32 func newApiCmd(ctx context.Context) cli.Command { 33 return cli.Command{ 34 Name: "api", 35 Usage: "Running API service", 36 Action: func(c *cli.Context) error { 37 return cmd.RunHttp(ctx) 38 }, 39 } 40 } 41 42 // newTlsCmd Running TLS service 43 func newTlsCmd(ctx context.Context) cli.Command { 44 return cli.Command{ 45 Name: "tls", 46 Usage: "Running TLS service", 47 Action: func(c *cli.Context) error { 48 return cmd.RunTls(ctx) 49 }, 50 } 51 } 52 53 // newOcspCmd Running OCSP service 54 func newOcspCmd(ctx context.Context) cli.Command { 55 return cli.Command{ 56 Name: "ocsp", 57 Usage: "Run OCSP service", 58 Action: func(c *cli.Context) error { 59 return cmd.RunOcsp(ctx) 60 }, 61 } 62 }