This repository has been archived on 2022-09-04. You can view files and clone it, but cannot push or open issues or pull requests.
dataupdater/utils/env/env.go
2021-04-25 17:02:58 +02:00

31 lines
407 B
Go

package envutils
import (
"os"
"strconv"
)
func GetenvInt(key string) int {
str := GetenvString(key)
if str == "" {
return 0
}
i, err := strconv.Atoi(str)
if err != nil {
return 0
}
return i
}
func GetenvBool(key string) bool {
str := GetenvString(key)
if str == "" {
return false
}
return str == "true" || str == "1"
}
func GetenvString(key string) string {
return os.Getenv(key)
}