summaryrefslogtreecommitdiff
path: root/docs/content/functions/env.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/content/functions/env.md')
-rw-r--r--docs/content/functions/env.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/content/functions/env.md b/docs/content/functions/env.md
new file mode 100644
index 00000000..ebbf8427
--- /dev/null
+++ b/docs/content/functions/env.md
@@ -0,0 +1,26 @@
+---
+title: env functions
+menu:
+ main:
+ parent: functions
+---
+
+## `env.Getenv`
+
+**Alias:** `getenv`
+
+Exposes the [os.Getenv](https://golang.org/pkg/os/#Getenv) function.
+
+This is a more forgiving alternative to using `.Env`, since missing keys will
+return an empty string.
+
+An optional default value can be given as well.
+
+#### Example
+
+```console
+$ gomplate -i 'Hello, {{env.Getenv "USER"}}'
+Hello, hairyhenderson
+$ gomplate -i 'Hey, {{getenv "FIRSTNAME" "you"}}!'
+Hey, you!
+``` \ No newline at end of file