Skip to content

Commit

Permalink
Merge pull request #17 from hairyhenderson/update-readme-for-getenv-d…
Browse files Browse the repository at this point in the history
…efault

Updating README with docs for getenv with default
  • Loading branch information
hairyhenderson committed Mar 22, 2016
2 parents e3d1917 + 4fda88c commit d107aa4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,17 @@ 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
$ echo 'Hello, {{getenv "USER"}}' | gomplate
Hello, hairyhenderson
$ echo 'Hey, {{getenv "FIRSTNAME" "you"}}!' | gomplate
Hey, you!
```

#### `bool`

Converts a true-ish string to a boolean. Can be used to simplify conditional statements based on environment variables or other text input.
Expand Down

0 comments on commit d107aa4

Please sign in to comment.