Add "getenv" as an wrapper for os.Getenv
authorquoha <quoha@quoha.org>
Mon, 16 Mar 2015 01:56:20 +0000 (20:56 -0500)
committerbep <bjorn.erik.pedersen@gmail.com>
Mon, 16 Mar 2015 17:38:43 +0000 (18:38 +0100)
Add a wrapper for the os.Getenv function. The
wrapper takes as input a string that is assumed to be an exported
variable name.

Fixes #977

tpl/template.go

index 9322dc0092203d7708467bce14fbd7dcf9e3e045..499e831862cf89da617c24153e7b2b097e03e3c6 100644 (file)
@@ -1341,6 +1341,7 @@ func init() {
                "getCSV":      GetCSV,
                "getCsv":      GetCSV,
                "seq":         helpers.Seq,
+               "getenv":      func(varName string) string { return os.Getenv(varName) },
        }
 
 }