providers/os: Add ability to read environment variables
This commit is contained in:
parent
68200e66d6
commit
541f2f0620
@ -27,6 +27,7 @@ type Provider struct {
|
||||
// FuncMap fulfills the step.FuncProvider interface.
|
||||
func (this *Provider) FuncMap () template.FuncMap {
|
||||
return template.FuncMap {
|
||||
"env": funcEnv,
|
||||
"fileExists": funcFileExists,
|
||||
"statFile": funcStatFile,
|
||||
"readFile": funcReadFile,
|
||||
@ -37,6 +38,10 @@ func (this *Provider) FuncMap () template.FuncMap {
|
||||
}
|
||||
}
|
||||
|
||||
func funcEnv (name string) string {
|
||||
return os.Getenv(name)
|
||||
}
|
||||
|
||||
func funcFileExists (name string) (bool) {
|
||||
_, err := os.Stat(name)
|
||||
return err == nil
|
||||
|
Loading…
Reference in New Issue
Block a user