Skip to content

Commit

Permalink
define router after gin.mode is set
Browse files Browse the repository at this point in the history
  • Loading branch information
Øyvind Hatland committed Oct 13, 2023
1 parent c1dd6ec commit 2458d4b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ func Setup() *gin.Engine {

func routerConfig() *gin.Engine {

router := gin.New()

env, exists := os.LookupEnv("ENVIRONMENT")
if !exists {
logrus.Warn("ENVIRONMENT environment variable not set, using default value: dev")
Expand All @@ -37,6 +35,8 @@ func routerConfig() *gin.Engine {
gin.SetMode(gin.DebugMode)
}

router := gin.New()

router.Use(
gin.LoggerWithWriter(gin.DefaultWriter, "/v1/health/"),
gin.Recovery(),
Expand Down

0 comments on commit 2458d4b

Please sign in to comment.