diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/content/functions/data.md | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/docs/content/functions/data.md b/docs/content/functions/data.md index 654e45af..277daafb 100644 --- a/docs/content/functions/data.md +++ b/docs/content/functions/data.md @@ -319,13 +319,24 @@ defined. Note: this does _not_ verify if the datasource is reachable. -Useful when used in an `if`/`else` block +Useful when used in an `if`/`else` block. ```console $ echo '{{if (datasourceExists "test")}}{{datasource "test"}}{{else}}no worries{{end}}' | gomplate no worries ``` +## `datasourceReachable` + +Tests whether or not a given datasource is defined and reachable, where the definition of "reachable" differs by datasource, but generally means the data is able to be read successfully. + +Useful when used in an `if`/`else` block. + +```console +$ gomplate -i '{{if (datasourceReachable "test")}}{{datasource "test"}}{{else}}no worries{{end}}' -d test=https://bogus.example.com/wontwork.json +no worries +``` + ## `ds` Alias to [`datasource`](#datasource) |
