docker-s3-backup/internal/util.go

23 lines
363 B
Go
Raw Permalink Normal View History

2023-09-14 22:15:37 +00:00
package internal
import (
"os"
"strconv"
2023-09-14 22:15:37 +00:00
)
func GetEnvWithDefault(name string, defaultValue string) string {
value := os.Getenv(name)
if value != "" {
return value
}
return defaultValue
}
func ParseIntDefault(value string, defaultValue int64) int64 {
ret, err := strconv.ParseInt(value, 10, 64)
if err != nil {
return defaultValue
}
return ret
}