Files
bl/logic/main.go
昔念 f4f3102021 feat(logic): 更新端口配置和启动参数
- 在 launch.json 中为 logic 服务添加 -port 参数
- 修改 config.go 中的 PortBL 配置,使用命令行参数
- 更新 main.go,解析命令行端口参数
- 移除 config.yaml 中的 port 配置项
2025-06-27 23:26:57 +08:00

30 lines
655 B
Go

package main
import (
_ "github.com/gogf/gf/contrib/nosql/redis/v2"
"github.com/gogf/gf/v2/os/gcmd"
"blazing/common/socket"
"blazing/common/socket/handler"
"blazing/cool"
"blazing/logic/controller"
"github.com/gogf/gf/v2/os/gctx"
)
func main() {
// 解析命令行参数
cool.Config.PortBL = gcmd.GetOpt("port", "27000").String()
if cool.IsRedisMode {
go cool.ListenFunc(gctx.New())
}
Start(cool.Config.PortBL) //注入service
}
func Start(port string) {
head := handler.NewTomeeHandler()
head.Callback = controller.Recv
socket.NewServer(socket.WithPort(port), socket.WithSocketHandler(head)).Start()
}