mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-11-03 15:45:51 +00:00
fix: configure middlewares before groups
This commit is contained in:
@@ -148,9 +148,6 @@ func (app *BootstrapApp) Setup() error {
|
|||||||
gin.SetMode(gin.ReleaseMode)
|
gin.SetMode(gin.ReleaseMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
router := engine.Group("/")
|
|
||||||
apiRouter := router.Group("/api")
|
|
||||||
|
|
||||||
// Create middlewares
|
// Create middlewares
|
||||||
var middlewares []Middleware
|
var middlewares []Middleware
|
||||||
|
|
||||||
@@ -169,9 +166,13 @@ func (app *BootstrapApp) Setup() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to initialize %s middleware: %T", middleware, err)
|
return fmt.Errorf("failed to initialize %s middleware: %T", middleware, err)
|
||||||
}
|
}
|
||||||
router.Use(middleware.Middleware())
|
engine.Use(middleware.Middleware())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create routers
|
||||||
|
mainRouter := engine.Group("/")
|
||||||
|
apiRouter := engine.Group("/api")
|
||||||
|
|
||||||
// Create controllers
|
// Create controllers
|
||||||
contextController := controller.NewContextController(controller.ContextControllerConfig{
|
contextController := controller.NewContextController(controller.ContextControllerConfig{
|
||||||
ConfiguredProviders: configuredProviders,
|
ConfiguredProviders: configuredProviders,
|
||||||
@@ -201,7 +202,7 @@ func (app *BootstrapApp) Setup() error {
|
|||||||
|
|
||||||
resourcesController := controller.NewResourcesController(controller.ResourcesControllerConfig{
|
resourcesController := controller.NewResourcesController(controller.ResourcesControllerConfig{
|
||||||
ResourcesDir: app.Config.ResourcesDir,
|
ResourcesDir: app.Config.ResourcesDir,
|
||||||
}, router)
|
}, mainRouter)
|
||||||
|
|
||||||
healthController := controller.NewHealthController(apiRouter)
|
healthController := controller.NewHealthController(apiRouter)
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ func NewProxyController(config ProxyControllerConfig, router *gin.RouterGroup, d
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (controller *ProxyController) SetupRoutes() {
|
func (controller *ProxyController) SetupRoutes() {
|
||||||
proxyGroup := controller.Router.Group("/api/auth")
|
proxyGroup := controller.Router.Group("/auth")
|
||||||
proxyGroup.GET("/:proxy", controller.proxyHandler)
|
proxyGroup.GET("/:proxy", controller.proxyHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ func (docker *DockerService) Init() error {
|
|||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
client.NegotiateAPIVersion(ctx)
|
client.NegotiateAPIVersion(ctx)
|
||||||
|
|
||||||
|
docker.Client = client
|
||||||
|
docker.Context = ctx
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user