mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-09 06:04:12 +00:00
add endpoint for listing repos while serving in api mode and add more metrics
This commit is contained in:
committed by
Benj Fassbind
parent
0fdba29d51
commit
9c6f896666
+3
-11
@@ -17,6 +17,7 @@ var context *ctx.AptlyContext
|
||||
|
||||
func apiMetricsGet() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
countPackagesByRepos()
|
||||
promhttp.Handler().ServeHTTP(c.Writer, c.Request)
|
||||
}
|
||||
}
|
||||
@@ -52,17 +53,8 @@ func Router(c *ctx.AptlyContext) http.Handler {
|
||||
}
|
||||
|
||||
if c.Config().ServeInAPIMode {
|
||||
router.GET("/repos/:storage/*pkgPath", func(c *gin.Context) {
|
||||
pkgpath := c.Param("pkgPath")
|
||||
|
||||
storage := c.Param("storage")
|
||||
if storage == "-" {
|
||||
storage = ""
|
||||
}
|
||||
|
||||
publicPath := context.GetPublishedStorage("filesystem:" + storage).(aptly.FileSystemPublishedStorage).PublicPath()
|
||||
c.FileFromFS(pkgpath, http.Dir(publicPath))
|
||||
})
|
||||
router.GET("/repos/", reposListInAPIMode(c.Config().FileSystemPublishRoots))
|
||||
router.GET("/repos/:storage/*pkgPath", reposServeInAPIMode)
|
||||
}
|
||||
|
||||
api := router.Group("/api")
|
||||
|
||||
Reference in New Issue
Block a user