mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-14 13:24:34 +02:00
- explicitly ignore returned parameters - replace Walk with faster WalkDir - log path error during hub dir sync - colorize static unit tests - removed duplicate import in crowdsec/main.go - typos - func tests: default datasource in tests/var/log instead of /tmp - action setup-go v3
21 lines
440 B
Go
21 lines
440 B
Go
package v1
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
jwt "github.com/appleboy/gin-jwt/v2"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func (c *Controller) HeartBeat(gctx *gin.Context) {
|
|
|
|
claims := jwt.ExtractClaims(gctx)
|
|
// TBD: use defined rather than hardcoded key to find back owner
|
|
machineID := claims["id"].(string)
|
|
|
|
if err := c.DBClient.UpdateMachineLastHeartBeat(machineID); err != nil {
|
|
c.HandleDBErrors(gctx, err)
|
|
return
|
|
}
|
|
gctx.Status(http.StatusOK)
|
|
}
|