mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-05 05:20:34 +00:00
add ready and healthy probe endpoints
This commit is contained in:
committed by
Benj Fassbind
parent
352f4e8772
commit
2020ca9971
+18
@@ -8,6 +8,7 @@ import (
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
@@ -27,6 +28,23 @@ func apiVersion(c *gin.Context) {
|
||||
c.JSON(200, gin.H{"Version": aptly.Version})
|
||||
}
|
||||
|
||||
// GET /api/ready
|
||||
func apiReady(isReady *atomic.Value) func(*gin.Context) {
|
||||
return func(c *gin.Context) {
|
||||
if isReady == nil || !isReady.Load().(bool) {
|
||||
c.JSON(503, gin.H{"Status": "Aptly is unavailable"})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(200, gin.H{"Status": "Aptly is ready"})
|
||||
}
|
||||
}
|
||||
|
||||
// GET /api/healthy
|
||||
func apiHealthy(c *gin.Context) {
|
||||
c.JSON(200, gin.H{"Status": "Aptly is healthy"})
|
||||
}
|
||||
|
||||
type dbRequestKind int
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user