forked from mtusi2026/mtusi2026lab7
21 lines
439 B
Go
21 lines
439 B
Go
package repositories
|
|
|
|
import (
|
|
"errors"
|
|
"os"
|
|
"strconv"
|
|
"time"
|
|
)
|
|
|
|
func UploadCleanupGrace() (time.Duration, error) {
|
|
value := os.Getenv("UPLOAD_CLEANUP_GRACE_SECONDS")
|
|
if value == "" {
|
|
value = "600"
|
|
}
|
|
seconds, err := strconv.Atoi(value)
|
|
if err != nil || seconds < 120 || seconds > 86400 {
|
|
return 0, errors.New("UPLOAD_CLEANUP_GRACE_SECONDS must be between 120 and 86400")
|
|
}
|
|
return time.Duration(seconds) * time.Second, nil
|
|
}
|