INNER CODE UNIT · Go
maxUploadSize
pilinux/gorest · example3/cmd/app/main.go:133
func maxUploadSize() int64 {
raw := strings.TrimSpace(os.Getenv("MAX_UPLOAD_SIZE_MB"))
if raw == "" {
return defaultMaxUploadSize
}
mb, err := strconv.ParseInt(raw, 10, 64)
// too large a value would overflow the shift into a negative limit
if err != nil || mb <= 0 || mb > math.MaxInt64>>20 {
return defaultMaxUploadSize
}
return mb << 20
}