fix: fixed gin not reconizing its mode

This commit is contained in:
2026-03-14 00:37:08 +03:30
parent 5c5d06722d
commit 0686614c54
+6 -5
View File
@@ -29,6 +29,12 @@ type RouterParams struct {
}
func NewGin(config *config.Config) *gin.Engine {
if config.AppEnv == "production" {
gin.SetMode(gin.ReleaseMode)
} else {
gin.SetMode(gin.DebugMode)
}
g := gin.New()
g.Use(gin.Recovery())
g.Use(cors.New(cors.Config{
@@ -36,11 +42,6 @@ func NewGin(config *config.Config) *gin.Engine {
AllowMethods: []string{"GET"},
AllowHeaders: []string{"Origin", "Content-Type"},
}))
if config.AppEnv == "production" {
gin.SetMode(gin.ReleaseMode)
} else {
gin.SetMode(gin.DebugMode)
}
return g
}