Skip to content

Commit

Permalink
max multipart memory
Browse files Browse the repository at this point in the history
  • Loading branch information
liuzhaomax committed Jul 27, 2024
1 parent 737c12b commit 5da4766
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions environment/config/dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ lib:
interval: 15
gin:
run_mode: debug # debug test release
max_multipart_memory: 10 # MB
db:
type: mysql
debug: true
Expand Down
1 change: 1 addition & 0 deletions environment/config/st.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ lib:
interval: 15
gin:
run_mode: debug # debug test release
max_multipart_memory: 10 # MB
db:
type: mysql
debug: true
Expand Down
6 changes: 4 additions & 2 deletions internal/core/gin.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ func init() {
}

type Gin struct {
RunMode string `mapstructure:"run_mode"`
RunMode string `mapstructure:"run_mode"`
MaxMultipartMemory int64 `mapstructure:"max_multipart_memory"`
}

// InitGinEngine Gin引擎的provider
func InitGinEngine() *gin.Engine {
gin.SetMode(GetConfig().Lib.Gin.RunMode) // debug, test, release
gin.SetMode(cfg.Lib.Gin.RunMode) // debug, test, release
app := gin.Default()
app.MaxMultipartMemory = cfg.Lib.Gin.MaxMultipartMemory << 20
return app
}

0 comments on commit 5da4766

Please sign in to comment.