Feat: login done
This commit is contained in:
@@ -3,7 +3,9 @@ package cmd
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"gitea.konchin.com/ytshih/inp2025/game/cmd/play"
|
||||
"gitea.konchin.com/ytshih/inp2025/game/cmd/serve"
|
||||
"gitea.konchin.com/ytshih/inp2025/game/utils"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
@@ -12,10 +14,12 @@ var RootCmd = &cobra.Command{
|
||||
Use: "game",
|
||||
Short: "Game for Intro. to Network Programming 2025",
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
ctx := cmd.Context()
|
||||
viper.AutomaticEnv()
|
||||
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
|
||||
viper.SetEnvKeyReplacer(strings.NewReplacer("_", "-"))
|
||||
viper.BindPFlags(cmd.PersistentFlags())
|
||||
viper.BindPFlags(cmd.Flags())
|
||||
utils.ReadConfig(ctx)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -23,4 +27,5 @@ func init() {
|
||||
cobra.EnableTraverseRunHooks = true
|
||||
|
||||
RootCmd.AddCommand(serve.RootCmd)
|
||||
RootCmd.AddCommand(play.RootCmd)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user