33 lines
542 B
Go
33 lines
542 B
Go
package cmds
|
|
|
|
import (
|
|
"inp2025/workflows"
|
|
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/viper"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
var gameCmd = &cobra.Command{
|
|
Use: "game",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
router := workflows.GameServer()
|
|
|
|
err := router.Listen(":" + viper.GetString("port"))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
zap.L().Info("server up",
|
|
zap.String("addr", router.ListenAddr()))
|
|
if err := router.WaitFor(); err != nil {
|
|
panic(err)
|
|
}
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
gameCmd.Flags().
|
|
String("port", "12345", "")
|
|
}
|