1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-06 08:16:19 +02:00
woodpecker/server/agent.go

21 lines
379 B
Go
Raw Normal View History

2015-04-30 23:41:52 +02:00
package server
import (
"github.com/drone/drone/common"
"github.com/gin-gonic/gin"
)
// GET /api/agents/token
func GetAgentToken(c *gin.Context) {
sess := ToSession(c)
token := &common.Token{}
2015-04-30 23:57:53 +02:00
token.Kind = common.TokenAgent
token.Label = "drone-agent"
2015-04-30 23:41:52 +02:00
tokenstr, err := sess.GenerateToken(token)
if err != nil {
c.Fail(500, err)
} else {
c.JSON(200, tokenstr)
}
}