diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2018-05-03 21:50:37 -0400 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2018-05-03 22:57:25 -0400 |
| commit | 6124d3dfd274ac24e5da0817ae172aca58c22d4e (patch) | |
| tree | 22acb5a6e7bbf59dd1337953445e036b06da94b5 /docs | |
| parent | 195a6dc75ddbc6f4899176d006c6dfba39e08f1a (diff) | |
Adding datasourceReachable function
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
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) |
