npm-cache-proxy/cli/utils.go
2019-04-21 19:01:49 +03:00

26 lines
341 B
Go

package cli
import (
"os"
"strconv"
)
func getEnvString(env string, def string) string {
value := os.Getenv(env)
if value != "" {
return value
} else {
return def
}
}
func getEnvInt(env string, def string) int {
value := getEnvString(env, def)
// TODO: handle error
converted, _ := strconv.Atoi(value)
return converted
}