drive-health/lib/web/net.go

30 lines
488 B
Go
Raw Normal View History

package web
import (
2024-01-22 00:36:05 +02:00
"github.com/JustKato/drive-health/lib/config"
"github.com/gin-gonic/gin"
)
func SetupRouter() *gin.Engine {
cfg := config.GetConfiguration()
if !cfg.DebugMode {
// Set gin to release
gin.SetMode(gin.ReleaseMode)
}
// Initialize the Gin engine
r := gin.Default()
2024-01-21 22:50:50 +02:00
r.Use(BasicAuthMiddleware(cfg.IdentityUsername, cfg.IdentityPassword))
// Setup Health Pings
setupHealth(r)
// Setup Api
setupApi(r)
// Setup Frontend
setupFrontend(r)
return r
}