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.
 | 
					// FuncMap fulfills the step.FuncProvider interface.
 | 
				
			||||||
func (this *Provider) FuncMap () template.FuncMap {
 | 
					func (this *Provider) FuncMap () template.FuncMap {
 | 
				
			||||||
	return template.FuncMap {
 | 
						return template.FuncMap {
 | 
				
			||||||
 | 
							"env":        funcEnv,
 | 
				
			||||||
		"fileExists": funcFileExists,
 | 
							"fileExists": funcFileExists,
 | 
				
			||||||
		"statFile":   funcStatFile,
 | 
							"statFile":   funcStatFile,
 | 
				
			||||||
		"readFile":   funcReadFile,
 | 
							"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) {
 | 
					func funcFileExists (name string) (bool) {
 | 
				
			||||||
	_, err := os.Stat(name)
 | 
						_, err := os.Stat(name)
 | 
				
			||||||
	return err == nil
 | 
						return err == nil
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user