diff --git a/internal/report/report.go b/internal/report/report.go index 31768e4..8b7faa9 100644 --- a/internal/report/report.go +++ b/internal/report/report.go @@ -1,20 +1,9 @@ package report const ( - GatewayURL = "http://127.0.0.1:%d" // 网关地址 - RegisterAPI = "/basic/register" // 模块注册接口 + RegisterAPI = "/basic/register" // 模块注册接口 ) -// RegisterRequest 模块注册请求参数 -type RegisterRequest struct { - Secret string `json:"secret"` // 通讯密钥 - ProxyPath string `json:"proxy_path"` // 代理路径 - ServiceURL string `json:"service_url"` // 服务地址 - Repository string `json:"repository"` // 服务代码仓库 - ServiceName string `json:"service_name"` // 服务名称 - ServiceVersion string `json:"service_version"` // 服务版本 -} - // RegisterResponse 模块注册响应参数 type RegisterResponse struct { Success bool `json:"success"` // 注册是否成功 diff --git a/internal/report/tool.go b/internal/report/tool.go index 54e87ac..cd57f1e 100644 --- a/internal/report/tool.go +++ b/internal/report/tool.go @@ -76,6 +76,7 @@ func RegisterModule(port int) error { ProxyPath: "/api", ServiceURL: fmt.Sprintf("http://127.0.0.1:%d", port), Repository: constant.Repository, + HeartbeatURL: fmt.Sprintf("http://127.0.0.1:%d/v1/common/heartbeat", port), ServiceName: constant.ServiceName, ServiceVersion: constant.Version, }).SetResult(&response).Post(RegisterAPI) diff --git a/internal/report/types.go b/internal/report/types.go index 51d3c1a..6abf9b2 100644 --- a/internal/report/types.go +++ b/internal/report/types.go @@ -12,5 +12,6 @@ type RegisterServiceRequest struct { ServiceURL string `json:"service_url"` // 服务地址 Repository string `json:"repository"` // 服务代码仓库 ServiceName string `json:"service_name"` // 服务名称 + HeartbeatURL string `json:"heartbeat_url"` // 心跳检测地址 ServiceVersion string `json:"service_version"` // 服务版本 }