✨ WatchTower admin API
This commit is contained in:
parent
bda9ab6c3d
commit
7cf9b80fe6
@ -41,6 +41,12 @@ func MapAPIs(app *fiber.App) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WatchTower administration APIs
|
||||||
|
wt := app.Group("/watchtower").Name("WatchTower").Use(auth.ValidatorMiddleware)
|
||||||
|
{
|
||||||
|
wt.Post("/maintenance/database", wtRunDbMaintenance)
|
||||||
|
}
|
||||||
|
|
||||||
// Common websocket gateway
|
// Common websocket gateway
|
||||||
app.Get("/ws", auth.ValidatorMiddleware, websocket.New(ws.Listen))
|
app.Get("/ws", auth.ValidatorMiddleware, websocket.New(ws.Listen))
|
||||||
|
|
||||||
|
15
pkg/internal/http/api/watchtower.go
Normal file
15
pkg/internal/http/api/watchtower.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.solsynth.dev/hypernet/nexus/pkg/internal/watchtower"
|
||||||
|
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
||||||
|
"github.com/gofiber/fiber/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func wtRunDbMaintenance(c *fiber.Ctx) error {
|
||||||
|
if err := sec.EnsureGrantedPerm(c, "AdminOperateWatchTower", true); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
go watchtower.RunDbMaintenance()
|
||||||
|
return c.SendStatus(fiber.StatusOK)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user