feat(logic): 更新端口配置和启动参数
- 在 launch.json 中为 logic 服务添加 -port 参数 - 修改 config.go 中的 PortBL 配置,使用命令行参数 - 更新 main.go,解析命令行端口参数 - 移除 config.yaml 中的 port 配置项
This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -4,6 +4,7 @@
|
||||
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
"name": "Launch login",
|
||||
"type": "go",
|
||||
@@ -18,6 +19,7 @@
|
||||
"request": "launch",
|
||||
"mode": "auto",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"args": ["-port=30000"],
|
||||
"program": "${workspaceFolder}/logic"
|
||||
}
|
||||
|
||||
|
||||
@@ -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
BIN
logic/1.exe
Normal file
Binary file not shown.
@@ -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())
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ redis:
|
||||
pass: 154252
|
||||
|
||||
blazing:
|
||||
port: 27000 ## 也是雪花算法生成端口
|
||||
autoMigrate: true
|
||||
eps: true
|
||||
file:
|
||||
|
||||
Reference in New Issue
Block a user