Skip to content

Commit

Permalink
fix: Prevent printing sensitive logs in non-debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
vvbbnn00 committed Mar 10, 2024
1 parent ad05abe commit e8c34ab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions route/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import (

// RegisterRoutes load all the enabled routes for the application
func RegisterRoutes() *gin.Engine {
router := gin.Default()

if config.GofletCfg.Debug {
gin.SetMode(gin.DebugMode)
gin.DefaultWriter = os.Stdout
Expand All @@ -28,6 +26,9 @@ func RegisterRoutes() *gin.Engine {
gin.DefaultWriter = io.Discard
}

// Router should be created after setting the mode
router := gin.Default()

// Log the requests
router.Use(middleware.SafeLogger())

Expand Down

0 comments on commit e8c34ab

Please sign in to comment.