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.
23 lines
333 B
23 lines
333 B
package goenv
|
|
|
|
import (
|
|
"go.dtapp.net/library/utils/gostring"
|
|
"os"
|
|
)
|
|
|
|
func GetEnvDefault(key, defVal string) string {
|
|
val, ok := os.LookupEnv(key)
|
|
if ok {
|
|
return val
|
|
}
|
|
return defVal
|
|
}
|
|
|
|
func GetEnvDefaultInt(key string, defVal int) int {
|
|
val, ok := os.LookupEnv(key)
|
|
if ok {
|
|
return gostring.ToInt(val)
|
|
}
|
|
return defVal
|
|
}
|