Allow octal and hex values for int flags

This is specifcally relevant to --change-permissions.
This commit is contained in:
Tim Hockin 2021-01-06 13:49:02 -08:00
parent 8ce96b33d3
commit ffba2eb119
1 changed files with 2 additions and 2 deletions

View File

@ -180,12 +180,12 @@ func envBool(key string, def bool) bool {
func envInt(key string, def int) int { func envInt(key string, def int) int {
if env := os.Getenv(key); env != "" { if env := os.Getenv(key); env != "" {
val, err := strconv.Atoi(env) val, err := strconv.ParseInt(env, 0, 0)
if err != nil { if err != nil {
log.Error(err, "invalid env value, using default", "key", key, "val", os.Getenv(key), "default", def) log.Error(err, "invalid env value, using default", "key", key, "val", os.Getenv(key), "default", def)
return def return def
} }
return val return int(val)
} }
return def return def
} }