summaryrefslogtreecommitdiffstats
path: root/routers/private/key.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/private/key.go')
-rw-r--r--routers/private/key.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/routers/private/key.go b/routers/private/key.go
index 9cc1165780..ee22f6ac48 100644
--- a/routers/private/key.go
+++ b/routers/private/key.go
@@ -72,6 +72,24 @@ func GetUserByKeyID(ctx *macaron.Context) {
ctx.JSON(200, user)
}
+//GetDeployKey chainload to models.GetDeployKey
+func GetDeployKey(ctx *macaron.Context) {
+ repoID := ctx.ParamsInt64(":repoid")
+ keyID := ctx.ParamsInt64(":keyid")
+ dKey, err := models.GetDeployKeyByRepo(keyID, repoID)
+ if err != nil {
+ if models.IsErrDeployKeyNotExist(err) {
+ ctx.JSON(404, []byte("not found"))
+ return
+ }
+ ctx.JSON(500, map[string]interface{}{
+ "err": err.Error(),
+ })
+ return
+ }
+ ctx.JSON(200, dKey)
+}
+
//HasDeployKey chainload to models.HasDeployKey
func HasDeployKey(ctx *macaron.Context) {
repoID := ctx.ParamsInt64(":repoid")