Skip to content

Commit

Permalink
fix: remove gin debug logs in production
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Dagelic <[email protected]>
  • Loading branch information
idagelic committed Jan 27, 2025
1 parent e5158d6 commit 1fa1ff8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,15 @@ func (a *ApiServer) Start() error {

binding.Validator = new(DefaultValidator)

gin.SetMode(gin.ReleaseMode)

a.router = gin.New()
a.router.Use(gin.Recovery())
if mode, ok := os.LookupEnv("DAYTONA_SERVER_MODE"); ok && mode == "development" {
a.router.Use(cors.New(cors.Config{
AllowAllOrigins: true,
}))
} else {
gin.SetMode(gin.ReleaseMode)
gin.SetMode(gin.DebugMode)
}

a.router.Use(middlewares.TelemetryMiddleware(a.telemetryService))
Expand Down

0 comments on commit 1fa1ff8

Please sign in to comment.