feat(report): add heartbeat URL to registration request and response
This commit is contained in:
parent
1172ecc2f1
commit
c8b3683cf2
@ -1,20 +1,9 @@
|
||||
package report
|
||||
|
||||
const (
|
||||
GatewayURL = "http://127.0.0.1:%d" // 网关地址
|
||||
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"` // 注册是否成功
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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"` // 服务版本
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user