backend/pkg/env/env.go

13 lines
172 B
Go
Raw Normal View History

2022-01-11 00:48:03 +08:00
package env
import "os"
func GetEnvDefault(key, defVal string) string {
val, ex := os.LookupEnv(key)
if !ex {
os.Setenv(key, defVal)
return defVal
}
return val
}