Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s3 api: get publish root list #1247

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 14 additions & 0 deletions api/s3.go
Original file line number Diff line number Diff line change
@@ -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)

Check warning on line 13 in api/s3.go

View check run for this annotation

Codecov / codecov/patch

api/s3.go#L8-L13

Added lines #L8 - L13 were not covered by tests
}
Loading