Opt: move init gin mod to bootstrap

pull/21/head
zijiren233 2 years ago
parent 6af3409727
commit 3bedc6ed41

@ -24,14 +24,14 @@ var ServerCmd = &cobra.Command{
bootstrap.InitSysNotify, bootstrap.InitSysNotify,
bootstrap.InitConfig, bootstrap.InitConfig,
bootstrap.InitLog, bootstrap.InitLog,
bootstrap.InitGinMode,
) )
if !flags.DisableUpdateCheck { if !flags.DisableUpdateCheck {
boot.Add(bootstrap.InitCheckUpdate) boot.Add(bootstrap.InitCheckUpdate)
} }
return boot.Run() return boot.Run()
}, },
PreRunE: func(cmd *cobra.Command, args []string) error { return InitGinMode() }, Run: Server,
Run: Server,
} }
func Server(cmd *cobra.Command, args []string) { func Server(cmd *cobra.Command, args []string) {

@ -1,11 +1,13 @@
package cmd package bootstrap
import ( import (
"context"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/synctv-org/synctv/cmd/flags" "github.com/synctv-org/synctv/cmd/flags"
) )
func InitGinMode() error { func InitGinMode(ctx context.Context) error {
if flags.Dev { if flags.Dev {
gin.SetMode(gin.DebugMode) gin.SetMode(gin.DebugMode)
} else { } else {
Loading…
Cancel
Save