Skip to content

Commit

Permalink
fix: cors not applied to all routes
Browse files Browse the repository at this point in the history
  • Loading branch information
leonard-henriquez committed Dec 4, 2023
1 parent c251aed commit 5b62322
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/buz/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ func (a *App) initializeManifold() {
func (a *App) initializeRouter() {
log.Info().Msg("🟢 initializing router")
a.engine = gin.New()
a.publicRouterGroup = a.engine.Group("")
a.switchableRouterGroup = a.engine.Group("")
if err := a.engine.SetTrustedProxies(nil); err != nil {
panic(err)
}
Expand Down Expand Up @@ -147,6 +145,11 @@ func (a *App) initializeMiddleware() {
}
}

func (a *App) initializeRouterGroups() {
a.publicRouterGroup = a.engine.Group("")
a.switchableRouterGroup = a.engine.Group("")
}

// 🐝 and healthcheck route are always public
func (a *App) initializePublicRoutes() {
log.Info().Msg("🟢 initializing buz route")
Expand Down Expand Up @@ -201,6 +204,7 @@ func (a *App) Initialize() {
a.initializeRouter()
a.initializeManifold()
a.initializeMiddleware()
a.initializeRouterGroups()
a.initializePublicRoutes()
a.initializeOpsRoutes()
a.initializeSchemaCacheRoutes()
Expand Down

0 comments on commit 5b62322

Please sign in to comment.