docker-s3-backup/internal/util.go

23 lines
363 B
Go

package internal
import (
"os"
"strconv"
)
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
}