TRA-4263 extensibility refactor (#770)

* Refactor routers

* refactor extension loading

* refactor server creation code

* Update main.go
This commit is contained in:
RamiBerm
2022-02-08 14:59:56 +02:00
committed by GitHub
parent f013b0f03c
commit 0a4674ea7c
13 changed files with 450 additions and 307 deletions

View File

@@ -6,9 +6,16 @@ import (
"github.com/gin-gonic/gin"
)
func InstallRoutes(ginApp *gin.Engine) {
var (
InstallGetIsNeededHandler = controllers.IsSetupNecessary
InstallPostAdminHandler = controllers.SetupAdminUser
)
func InstallRoutes(ginApp *gin.Engine) *gin.RouterGroup {
routeGroup := ginApp.Group("/install")
routeGroup.GET("/isNeeded", controllers.IsSetupNecessary)
routeGroup.POST("/admin", controllers.SetupAdminUser)
routeGroup.GET("/isNeeded", func(c *gin.Context) { InstallGetIsNeededHandler(c) })
routeGroup.POST("/admin", func(c *gin.Context) { InstallPostAdminHandler(c) })
return routeGroup
}