From 0ca223237a0714eebe4e8f3da10e09031999537f Mon Sep 17 00:00:00 2001 From: jeevansai Date: Sat, 5 Feb 2022 19:52:00 +0530 Subject: Add function to list datasources (#1287) * Add function to list datasources * Sort datasources in ascending order and return in listDatasources * Fix lint error Signed-off-by: Dave Henderson Co-authored-by: Dave Henderson --- docs-src/content/functions/data.yml | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'docs-src/content') diff --git a/docs-src/content/functions/data.yml b/docs-src/content/functions/data.yml index 15106372..8fa47736 100644 --- a/docs-src/content/functions/data.yml +++ b/docs-src/content/functions/data.yml @@ -62,6 +62,15 @@ funcs: - | $ gomplate -i '{{if (datasourceReachable "test")}}{{datasource "test"}}{{else}}no worries{{end}}' -d test=https://bogus.example.com/wontwork.json no worries + - name: listDatasources + description: | + Lists all the datasources defined, list returned will be sorted in ascending order. + pipeline: false + examples: + - | + $ gomplate -d person=env:///FOO -d bar=env:///BAR -i '{{range (listDatasources)}} Datasource-{{.}} {{end}}' + Datasource-bar + Datasource-person - name: defineDatasource description: | Define a datasource alias with target URL inside the template. Overridden by the [`--datasource/-d`](../../usage/#datasource-d) flag. -- cgit v1.2.3