Skip to content

Commit b5b0a52

Browse files
committed
s3 api: get publish root list
1 parent a0af6a2 commit b5b0a52

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

api/router.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ func Router(c *ctx.AptlyContext) http.Handler {
140140
api.POST("/gpg/key", apiGPGAddKey)
141141
}
142142

143+
{
144+
api.GET("/s3", apiS3List)
145+
}
146+
143147
{
144148
api.GET("/files", apiFilesListDirs)
145149
api.POST("/files/:dir", apiFilesUpload)

api/s3.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package api
2+
3+
import (
4+
"github.com/gin-gonic/gin"
5+
)
6+
7+
// GET /api/s3
8+
func apiS3List(c *gin.Context) {
9+
keys := []string{}
10+
for k := range context.Config().S3PublishRoots {
11+
keys = append(keys, k)
12+
}
13+
c.JSON(200, keys)
14+
}

0 commit comments

Comments
 (0)