From 3fbaf7aeb6a6520efdc263e6afe9594d84f63e43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AF=BB=E6=AC=A2?= Date: Sun, 10 Dec 2023 08:19:21 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.yaml | 2 +- readme.md | 4 ++-- utils/callback.go | 6 +++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/config.yaml b/config.yaml index 1b212d61..b5a93a7e 100644 --- a/config.yaml +++ b/config.yaml @@ -4,7 +4,7 @@ wechat: host: 10.0.0.73:19088 # 是否在启动的时候自动设置hook服务的回调 autoSetCallback: false - # 回调IP,如果是Docker运行,本参数必填,如果Docker修改了映射,格式为 ip:port + # 回调IP,如果是Docker运行,本参数必填(填auto表示自动,不适用于 docker 环境),如果Docker修改了映射,格式为 ip:port callback: 10.0.0.51 # 转发到其他地址 forward: diff --git a/readme.md b/readme.md index 87e2b4c6..8c4aea31 100644 --- a/readme.md +++ b/readme.md @@ -16,8 +16,8 @@ wechat: host: wechat:19088 # 是否在启动的时候自动设置hook服务的回调 autoSetCallback: true - # 回调IP,如果是Docker运行,本参数必填,如果Docker修改了映射,格式为 ip:port,如果使用项目提供的docker-compsoe.yaml文件启动,可以不写 - callback: + # 回调IP,如果是Docker运行,本参数必填,如果Docker修改了映射,格式为 ip:port,如果使用项目提供的docker-compsoe.yaml文件启动,可以填`auto` + callback: auto # 数据库 mysql: diff --git a/utils/callback.go b/utils/callback.go index 1189f59c..306b68ff 100644 --- a/utils/callback.go +++ b/utils/callback.go @@ -29,7 +29,11 @@ func ClearCallback() { // @param host func SetCallback(userHost string) { // 获取本机IP地址 - host := net.ParseIP(netutil.GetInternalIp()).String() + host := userHost + if userHost == "auto" { + host = net.ParseIP(netutil.GetInternalIp()).String() + } + port := 19099 if userHost != "" { uh := strings.Split(strings.TrimSpace(userHost), ":")