You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-06-30 22:13:45 +02:00
19 lines
318 B
Go
19 lines
318 B
Go
![]() |
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{}
|
||
|
tokenstr, err := sess.GenerateToken(token)
|
||
|
if err != nil {
|
||
|
c.Fail(500, err)
|
||
|
} else {
|
||
|
c.JSON(200, tokenstr)
|
||
|
}
|
||
|
}
|