mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-04 14:22:26 +08:00
寻路服务器
This commit is contained in:
23
cmd/hk4e/pathfinding.go
Normal file
23
cmd/hk4e/pathfinding.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"hk4e/pathfinding/app"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// PathfindingCmd 检查配表命令
|
||||
func PathfindingCmd() *cobra.Command {
|
||||
var cfg string
|
||||
c := &cobra.Command{
|
||||
Use: "pathfinding",
|
||||
Short: "pathfinding 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
|
||||
}
|
||||
8
cmd/pathfinding/application.toml
Normal file
8
cmd/pathfinding/application.toml
Normal file
@@ -0,0 +1,8 @@
|
||||
[logger]
|
||||
level = "DEBUG"
|
||||
mode = "BOTH"
|
||||
track = true
|
||||
max_size = 10485760
|
||||
|
||||
[mq]
|
||||
nats_url = "nats://nats:4222"
|
||||
25
cmd/pathfinding/main.go
Normal file
25
cmd/pathfinding/main.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
_ "net/http/pprof"
|
||||
"os"
|
||||
|
||||
"hk4e/pathfinding/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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user