How to set gin mode to release mode?

Soroosh picture Soroosh · Sep 25, 2017 · Viewed 15.2k times · Source

I need to set gin mode to release mode. How should I do it?

Now when I run my API there is a hint like this:

[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
 - using env:   export GIN_MODE=release
 - using code:  gin.SetMode(gin.ReleaseMode)

I tried gin.SetMode(gin.ReleaseMode) but it does not work. I initialize my router here:

gin.SetMode(gin.releaseMode)    
router := gin.Default()

Answer

Kunal Kapadia picture Kunal Kapadia · Feb 22, 2018

Just set GIN_MODE=release to your environment config.