You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
220 B
20 lines
220 B
package envvars
|
|
|
|
import (
|
|
"os"
|
|
"strconv"
|
|
)
|
|
|
|
func Int(key string) int {
|
|
value := os.Getenv(key)
|
|
if value == "" {
|
|
return 0
|
|
}
|
|
|
|
intValue, err := strconv.Atoi(value)
|
|
if err != nil {
|
|
return 0
|
|
}
|
|
|
|
return intValue
|
|
}
|