Draft: feat login

This commit is contained in:
2025-09-05 03:59:25 +08:00
parent 6d7074198f
commit b190a50e90
19 changed files with 589 additions and 83 deletions

View File

@@ -4,6 +4,7 @@ import (
"strings"
"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 +13,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)
},
}