mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-10-29 05:05:42 +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)
|
||||
}
|
||||
|
||||
router := engine.Group("/")
|
||||
apiRouter := router.Group("/api")
|
||||
|
||||
// Create middlewares
|
||||
var middlewares []Middleware
|
||||
|
||||
@@ -169,9 +166,13 @@ func (app *BootstrapApp) Setup() error {
|
||||
if err != nil {
|
||||
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
|
||||
contextController := controller.NewContextController(controller.ContextControllerConfig{
|
||||
ConfiguredProviders: configuredProviders,
|
||||
@@ -201,7 +202,7 @@ func (app *BootstrapApp) Setup() error {
|
||||
|
||||
resourcesController := controller.NewResourcesController(controller.ResourcesControllerConfig{
|
||||
ResourcesDir: app.Config.ResourcesDir,
|
||||
}, router)
|
||||
}, mainRouter)
|
||||
|
||||
healthController := controller.NewHealthController(apiRouter)
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ func NewProxyController(config ProxyControllerConfig, router *gin.RouterGroup, d
|
||||
}
|
||||
|
||||
func (controller *ProxyController) SetupRoutes() {
|
||||
proxyGroup := controller.Router.Group("/api/auth")
|
||||
proxyGroup := controller.Router.Group("/auth")
|
||||
proxyGroup.GET("/:proxy", controller.proxyHandler)
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,9 @@ func (docker *DockerService) Init() error {
|
||||
|
||||
ctx := context.Background()
|
||||
client.NegotiateAPIVersion(ctx)
|
||||
|
||||
docker.Client = client
|
||||
docker.Context = ctx
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user