1
0
Fork 0
mirror of https://github.com/Luzifer/korvike.git synced 2024-11-08 23:40:05 +00:00
korvike/functions/func_env.go

17 lines
268 B
Go
Raw Normal View History

2016-09-14 11:06:04 +00:00
package functions
2016-07-31 19:13:01 +00:00
import "os"
func init() {
registerFunction("env", func(name string, v ...string) string {
defaultValue := ""
if len(v) > 0 {
defaultValue = v[0]
}
if value, ok := os.LookupEnv(name); ok {
return value
}
return defaultValue
})
}