feat(coolconfig): 修改端口配置字段名称

将配置结构体中的Port字段重命名为LoginPort,以更准确地反映其用途
作为登录端口配置,避免与GameOnlineID字段的注释混淆
```
This commit is contained in:
昔念
2026-01-20 16:59:23 +08:00
parent 07d25b3e96
commit 8049e273f6
8 changed files with 25 additions and 21 deletions

View File

@@ -10,7 +10,7 @@ type sConfig struct {
Eps bool `json:"eps,omitempty"` // 是否开启eps
File *file `json:"file,omitempty"` // 文件上传配置
Name string `json:"name"` // 项目名称
Port string `json:"port"`
LoginPort string `json:"port"`
GameOnlineID uint16 `json:"port_bl"` //这个是命令行输入的参数
ServerInfo ServerList
@@ -70,7 +70,7 @@ func newConfig() *sConfig {
AutoMigrate: GetCfgWithDefault(ctx, "blazing.autoMigrate", g.NewVar(false)).Bool(),
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()),
LoginPort: string(GetCfgWithDefault(ctx, "server.port", g.NewVar("8080")).String()),
RPC: GetCfgWithDefault(ctx, "server.rpc", g.NewVar("8080")).Uint16(),
//GamePort: GetCfgWithDefault(ctx, "server.game", g.NewVar("8080")).Uint64s(),

File diff suppressed because one or more lines are too long

View File

@@ -4,7 +4,6 @@ import (
"blazing/common/data/share"
"blazing/cool"
"blazing/modules/base/service"
"context"
"fmt"
"log"
@@ -85,7 +84,7 @@ func StartClient(id, port uint16, callback any) *struct {
RegisterLogic func(uint16, uint16) error
} {
var rpcaddr, _ = service.NewBaseSysParamService().DataByKey(context.Background(), "server_ip")
var rpcaddr = cool.Config.File.Domain
//rpcaddr = "127.0.0.1"
closer1, err := jsonrpc.NewMergeClient(context.Background(),
"ws://"+rpcaddr+":"+rpcport, "", []interface{}{

View File

@@ -71,14 +71,14 @@ func Start() {
socket.WithCORS(),
socket.WithPort(port),
)
// go func() {
rpcClient := rpc.StartClient(serverID, uint16(port), server)
rpcClient := rpc.StartClient(serverID, uint16(port), server) //连接rpc
controller.Maincontroller.RPCClient = *rpcClient //将RPC赋值Start
controller.Maincontroller.Port = uint16(port) //赋值服务器ID
controller.Init(true)
xmlres.Initfile()
config.NewServerService().SetServerID(serverID, gconv.Uint16(port))
config.NewServerService().SetServerID(serverID, gconv.Uint16(port)) //设置当前服务器端口
server.Boot()
}

View File

@@ -9,7 +9,7 @@ import (
"github.com/gogf/gf/v2/util/gconv"
)
var defaultPort = gconv.Int(cool.Config.Port) //读入默认的端口
var defaultPort = gconv.Int(cool.Config.LoginPort) //读入默认的端口
func reg() {
go rpc.StartServer()
controller.Init(false)

View File

@@ -1,12 +1,12 @@
server:
name: "blazing server"
address: ":59480" #服务器地址
port: 53388 #后台服务器端口
address: ":59480" #服务器地址
port: 53388 #验证服务器端口
rpc: 56409 #rpc服务端口
openapiPath: "/api.json"
swaggerPath: "/swagger"
clientMaxBodySize:
104857600 # 100MB in bytes 100*1024*1024
1048576 # 100MB in bytes 1*1024*1024
# 平滑重启特性
graceful: true # 是否开启平滑重启特性开启时将会在本地增加10000的本地TCP端口用于进程间通信默认false
gracefulTimeout: 2 # 父进程在平滑重启后多少秒退出默认2秒若请求耗时大于该值可能会导致请求中断
@@ -18,7 +18,7 @@ logger:
database:
default:
type: "pgsql"
host: "125.208.20.223"
host: "192.140.190.212"
port: "55669"
user: "bl"
pass: "4DD4z3T2Zh8rx8Yd"
@@ -53,7 +53,7 @@ database:
# Redis 配置示例
redis:
cool:
address: "125.208.20.223:57095"
address: "192.140.190.212:57095"
db: 0
pass: "redis_wQ22jj"
@@ -61,8 +61,9 @@ blazing:
autoMigrate: true
eps: true
file:
mode: "local" # local | minio | oss
domain: "http://127.0.0.1:8002"
mode: "zhuanzhuan" # local | minio | oss
#前端上传地址,因为放弃本地,所以这个弃用了 ,现在被当成后端验证服务器地址
domain: "192.140.190.212"
# oss配置项兼容 minio oss 需要配置bucket公开读
oss:
endpoint: "192.168.192.110:9000"

View File

@@ -64,15 +64,17 @@ func (c *BaseSysUserController) GetSession(ctx context.Context, req *SessionReq)
}
if cool.Config.ServerInfo.IsDebug != 0 {
res.IsDebug = 1
res.LoginAddr = "192.168.1.44:53888"
} else {
res.LoginAddr = cool.Config.File.Domain + ":" + cool.Config.LoginPort
}
return
}
type SessionRes struct {
UserID int `json:"userid"`
Session string `json:"session"`
IsDebug int `json:"isDebug"`
UserID int `json:"userid"`
Session string `json:"session"`
LoginAddr string `json:"loginaddr"`
//Server model.ServerList `json:"server"`
}

View File

@@ -40,7 +40,9 @@ func init() {
g.Server().BindMiddleware("/admin/*", BaseAuthorityMiddleware)
// g.Server().BindMiddleware("/*", AutoI18n)
g.Server().BindMiddleware("/*", MiddlewareCORS)
// g.Server().BindMiddleware("/getip", func(r *ghttp.Request) {
// r.Response.Write(cool.Config.File.Domain + ":" + gconv.String(cool.Config.LoginPort))
// })
}
if config.Config.Middleware.Log.Enable {
g.Server().BindMiddleware("/admin/*", BaseLog)