拆分战斗服务器

This commit is contained in:
huangxiaolei
2022-12-19 22:11:55 +08:00
parent cf4804c444
commit 0dc45708d6
21 changed files with 793 additions and 349 deletions

View File

@@ -0,0 +1,8 @@
[logger]
level = "DEBUG"
mode = "BOTH"
track = true
max_size = 10485760
[mq]
nats_url = "nats://nats:4222"

25
cmd/fight/main.go Normal file
View File

@@ -0,0 +1,25 @@
package main
import (
"context"
"flag"
"fmt"
_ "net/http/pprof"
"os"
"hk4e/fight/app"
)
var (
config = flag.String("config", "application.toml", "config file")
)
func main() {
flag.Parse()
// go statsviz_serve.Serve("0.0.0.0:2345")
err := app.Run(context.TODO(), *config)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}

23
cmd/hk4e/fight.go Normal file
View File

@@ -0,0 +1,23 @@
package main
import (
"context"
"hk4e/fight/app"
"github.com/spf13/cobra"
)
// FightCmd 检查配表命令
func FightCmd() *cobra.Command {
var cfg string
c := &cobra.Command{
Use: "fight",
Short: "fight server",
RunE: func(cmd *cobra.Command, args []string) error {
return app.Run(context.Background(), cfg)
},
}
c.Flags().StringVar(&cfg, "config", "application.toml", "config file")
return c
}