From b5b0a52cbe03d15a56e6585d6722e5bc40d93ef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Roth?= Date: Fri, 29 Dec 2023 14:00:12 +0100 Subject: [PATCH] s3 api: get publish root list --- api/router.go | 4 ++++ api/s3.go | 14 ++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 api/s3.go diff --git a/api/router.go b/api/router.go index ea1dc27f9..ddd30e976 100644 --- a/api/router.go +++ b/api/router.go @@ -140,6 +140,10 @@ func Router(c *ctx.AptlyContext) http.Handler { api.POST("/gpg/key", apiGPGAddKey) } + { + api.GET("/s3", apiS3List) + } + { api.GET("/files", apiFilesListDirs) api.POST("/files/:dir", apiFilesUpload) diff --git a/api/s3.go b/api/s3.go new file mode 100644 index 000000000..4273d6fc7 --- /dev/null +++ b/api/s3.go @@ -0,0 +1,14 @@ +package api + +import ( + "github.com/gin-gonic/gin" +) + +// GET /api/s3 +func apiS3List(c *gin.Context) { + keys := []string{} + for k := range context.Config().S3PublishRoots { + keys = append(keys, k) + } + c.JSON(200, keys) +}