Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "start", Short: "vblog项目后端", Long: ``, Run: func(cmd *cobra.Command, args []string) { switch configType { case "env": _, err := conf.LoadConfigFromEnv() cobra.CheckErr(err) default: _, err := conf.LoadConfigFromToml(configFile) cobra.CheckErr(err) } r := gin.Default() logger.L().Debug().Msgf("controllers: %s", ioc.ShowConntrollers()) logger.L().Debug().Msgf("apis: %s", ioc.ShowApis()) err := ioc.InitController() cobra.CheckErr(err) err = ioc.InitHttpApi("/vblog/api/v1", r) cobra.CheckErr(err) httpServer := protocol.NewHttp(r) go func() { herr := httpServer.Start() if herr != http.ErrServerClosed { cobra.CheckErr(herr) } }() grpcServer := protocol.NewGrpc() go func() { gerr := grpcServer.Start() cobra.CheckErr(gerr) }() err = libioc.InitIocObject() cobra.CheckErr(err) ch := make(chan os.Signal, 1) signal.Notify(ch, syscall.SIGTERM, syscall.SIGINT, syscall.SIGHUP, syscall.SIGQUIT) s := <-ch logger.L().Info().Msgf("receive os signal: %s, exit ...", s) ctx := context.Background() httpServer.Stop(ctx) grpcServer.Stop(ctx) conf.C().MySQL.Close() }, }
root command vblog-api start
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.