refactor(server): use boxstore helpers and file status consts
- Move box ID validation, file listing/pathing, manifest creation, and uploads to `boxstore` - Use shared helpers for safe filenames and polling interval env parsing - Add file status constants to `models` to avoid duplicated magic strings across handlersrefactor(server): use boxstore helpers and file status consts - Move box ID validation, file listing/pathing, manifest creation, and uploads to `boxstore` - Use shared helpers for safe filenames and polling interval env parsing - Add file status constants to `models` to avoid duplicated magic strings across handlers
This commit is contained in:
20
lib/helpers/env.go
Normal file
20
lib/helpers/env.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package helpers
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func EnvInt(name string, fallback int, minimum int) int {
|
||||
rawValue := os.Getenv(name)
|
||||
if rawValue == "" {
|
||||
return fallback
|
||||
}
|
||||
|
||||
value, err := strconv.Atoi(rawValue)
|
||||
if err != nil || value < minimum {
|
||||
return fallback
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
Reference in New Issue
Block a user