Skip to content

Commit 8435cbe

Browse files
committed
fix: configure middlewares before groups
1 parent 77296da commit 8435cbe

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

‎internal/bootstrap/app_bootstrap.go‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@ func (app *BootstrapApp) Setup() error {
148148
gin.SetMode(gin.ReleaseMode)
149149
}
150150

151-
router := engine.Group("/")
152-
apiRouter := router.Group("/api")
153-
154151
// Create middlewares
155152
var middlewares []Middleware
156153

@@ -169,9 +166,13 @@ func (app *BootstrapApp) Setup() error {
169166
if err != nil {
170167
return fmt.Errorf("failed to initialize %s middleware: %T", middleware, err)
171168
}
172-
router.Use(middleware.Middleware())
169+
engine.Use(middleware.Middleware())
173170
}
174171

172+
// Create routers
173+
mainRouter := engine.Group("/")
174+
apiRouter := engine.Group("/api")
175+
175176
// Create controllers
176177
contextController := controller.NewContextController(controller.ContextControllerConfig{
177178
ConfiguredProviders: configuredProviders,
@@ -201,7 +202,7 @@ func (app *BootstrapApp) Setup() error {
201202

202203
resourcesController := controller.NewResourcesController(controller.ResourcesControllerConfig{
203204
ResourcesDir: app.Config.ResourcesDir,
204-
}, router)
205+
}, mainRouter)
205206

206207
healthController := controller.NewHealthController(apiRouter)
207208

‎internal/controller/proxy_controller.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func NewProxyController(config ProxyControllerConfig, router *gin.RouterGroup, d
3838
}
3939

4040
func (controller *ProxyController) SetupRoutes() {
41-
proxyGroup := controller.Router.Group("/api/auth")
41+
proxyGroup := controller.Router.Group("/auth")
4242
proxyGroup.GET("/:proxy", controller.proxyHandler)
4343
}
4444

‎internal/service/docker_service.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ func (docker *DockerService) Init() error {
3030

3131
ctx := context.Background()
3232
client.NegotiateAPIVersion(ctx)
33+
34+
docker.Client = client
35+
docker.Context = ctx
3336
return nil
3437
}
3538

0 commit comments

Comments
 (0)