feat(logic): 更新端口配置和启动参数

- 在 launch.json 中为 logic 服务添加 -port 参数
- 修改 config.go 中的 PortBL 配置,使用命令行参数
- 更新 main.go,解析命令行端口参数
- 移除 config.yaml 中的 port 配置项
This commit is contained in:
2025-06-27 23:26:57 +08:00
parent 741ef6ebd4
commit f4f3102021
5 changed files with 30 additions and 26 deletions

50
.vscode/launch.json vendored
View File

@@ -1,25 +1,27 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch login",
"type": "go",
"request": "launch",
"mode": "auto",
"cwd": "${workspaceFolder}",
"program": "${workspaceFolder}/login"
},
{
"name": "Launch logic",
"type": "go",
"request": "launch",
"mode": "auto",
"cwd": "${workspaceFolder}",
"program": "${workspaceFolder}/logic"
}
]
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch login",
"type": "go",
"request": "launch",
"mode": "auto",
"cwd": "${workspaceFolder}",
"program": "${workspaceFolder}/login"
},
{
"name": "Launch logic",
"type": "go",
"request": "launch",
"mode": "auto",
"cwd": "${workspaceFolder}",
"args": ["-port=30000"],
"program": "${workspaceFolder}/logic"
}
]
}

View File

@@ -37,7 +37,7 @@ func newConfig() *sConfig {
Name: GetCfgWithDefault(ctx, "server.name", g.NewVar("")).String(),
Eps: GetCfgWithDefault(ctx, "blazing.eps", g.NewVar(false)).Bool(),
Port: string(GetCfgWithDefault(ctx, "server.port", g.NewVar("8080")).String()),
PortBL: string(GetCfgWithDefault(ctx, "blazing.port", g.NewVar("8080")).String()),
//PortBL: string(GetCfgWithDefault(ctx, "blazing.port", g.NewVar("8080")).String()),
File: &file{
Mode: GetCfgWithDefault(ctx, "blazing.file.mode", g.NewVar("none")).String(),
Domain: GetCfgWithDefault(ctx, "blazing.file.domain", g.NewVar("http://127.0.0.1:8300")).String(),

BIN
logic/1.exe Normal file

Binary file not shown.

View File

@@ -2,6 +2,7 @@ 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"
@@ -12,6 +13,8 @@ import (
)
func main() {
// 解析命令行参数
cool.Config.PortBL = gcmd.GetOpt("port", "27000").String()
if cool.IsRedisMode {
go cool.ListenFunc(gctx.New())
}

View File

@@ -50,7 +50,6 @@ redis:
pass: 154252
blazing:
port: 27000 ## 也是雪花算法生成端口
autoMigrate: true
eps: true
file: