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 }