forked from mtusi2026/mtusi2026lab2
init(app) moved app code from Lab1
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package health
|
||||
|
||||
import (
|
||||
"sync/atomic"
|
||||
|
||||
"gitflic.ru/project/bulla-max/mtusi2026lab1/internal/common"
|
||||
"github.com/gofiber/fiber/v3"
|
||||
)
|
||||
|
||||
var shuttingDown atomic.Bool
|
||||
|
||||
func SignalShutdown() {
|
||||
shuttingDown.Store(true)
|
||||
}
|
||||
|
||||
func live(c fiber.Ctx) error {
|
||||
return c.JSON(fiber.Map{"status": "ok"})
|
||||
}
|
||||
|
||||
func ready(c fiber.Ctx) error {
|
||||
if shuttingDown.Load() {
|
||||
return common.SendError(c, fiber.StatusInternalServerError,
|
||||
common.ErrorCodeInternal, "app currently shutting down")
|
||||
}
|
||||
|
||||
return c.JSON(fiber.Map{"status": "ok"})
|
||||
}
|
||||
Reference in New Issue
Block a user