feat: 添加节点管理功能,支持全局 discovery token 生成与旋转,更新节点注册流程

This commit is contained in:
ryan
2026-03-10 15:48:34 +08:00
parent 05e75549d2
commit 92d22fc02c
14 changed files with 321 additions and 124 deletions
+32
View File
@@ -32,6 +32,38 @@ func CreateNode(c *gin.Context) {
})
}
func GetNodeBootstrapToken(c *gin.Context) {
bootstrap, err := service.GetNodeBootstrapView()
if err != nil {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": err.Error(),
})
return
}
c.JSON(http.StatusOK, gin.H{
"success": true,
"message": "",
"data": bootstrap,
})
}
func RotateNodeBootstrapToken(c *gin.Context) {
bootstrap, err := service.RotateGlobalDiscoveryToken()
if err != nil {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": err.Error(),
})
return
}
c.JSON(http.StatusOK, gin.H{
"success": true,
"message": "",
"data": bootstrap,
})
}
func UpdateNode(c *gin.Context) {
id, err := strconv.ParseUint(c.Param("id"), 10, 64)
if err != nil || id == 0 {