harness-drone/server/agent.go

19 lines
318 B
Go
Raw Normal View History

2015-04-30 21:41:52 +00: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{}
tokenstr, err := sess.GenerateToken(token)
if err != nil {
c.Fail(500, err)
} else {
c.JSON(200, tokenstr)
}
}