Skip to content

Commit 770c951

Browse files
committed
feat: enhance body limit configuration based on chunk size and max video size
1 parent 0a0dcaf commit 770c951

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

main.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,22 @@ func main() {
101101
defer uploadTracker.Close()
102102
}
103103

104+
// Configure body limit based on chunk size or max video size
105+
bodyLimit := 4 * 1024 * 1024 // Default 4MB
106+
if config.UploadingEnabled {
107+
if config.ChunkSize > 0 {
108+
bodyLimit = int(config.ChunkSize) + (1 * 1024 * 1024) // ChunkSize + 1MB buffer
109+
} else if config.MaxVideoSize > 0 {
110+
bodyLimit = config.MaxVideoSize * 1024 * 1024
111+
} else {
112+
bodyLimit = 100 * 1024 * 1024 // Default 100MB if no limits set
113+
}
114+
}
115+
104116
app := fiber.New(fiber.Config{
105117
DisableStartupMessage: true,
106118
Prefork: config.Prefork,
119+
BodyLimit: bodyLimit,
107120
})
108121

109122
prometheusModule := fiberprometheus.New("media-proxy")

0 commit comments

Comments
 (0)