feat(docker): add healthcheck and wget dependency
Adds a healthcheck endpoint and updates Dockerfile/README to include wget and define healthcheck logic.
This commit is contained in:
@@ -3,6 +3,7 @@ package routing
|
||||
import "github.com/gin-gonic/gin"
|
||||
|
||||
type Handlers struct {
|
||||
Health gin.HandlerFunc
|
||||
Index gin.HandlerFunc
|
||||
ShowBox gin.HandlerFunc
|
||||
BoxLogin gin.HandlerFunc
|
||||
@@ -34,6 +35,7 @@ type Handlers struct {
|
||||
}
|
||||
|
||||
func Register(router *gin.Engine, handlers Handlers) {
|
||||
router.GET("/health", handlers.Health)
|
||||
router.GET("/", handlers.Index)
|
||||
|
||||
router.GET("/box/:id", handlers.ShowBox)
|
||||
|
||||
@@ -48,6 +48,7 @@ func Run(addr string) error {
|
||||
router.SetHTMLTemplate(htmlTemplates)
|
||||
|
||||
routing.Register(router, routing.Handlers{
|
||||
Health: app.handleHealth,
|
||||
Index: app.handleIndex,
|
||||
ShowBox: app.handleShowBox,
|
||||
BoxLogin: handleBoxLogin,
|
||||
@@ -114,3 +115,9 @@ func applyBoxstoreRuntimeConfig(cfg *config.Config) {
|
||||
boxstore.SetUploadRoot(cfg.UploadsDir)
|
||||
boxstore.SetOneTimeDownloadExpiry(cfg.OneTimeDownloadExpirySeconds)
|
||||
}
|
||||
|
||||
func (app *App) handleHealth(c *gin.Context) {
|
||||
c.JSON(200, gin.H{
|
||||
"status": "healthy",
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user