From 6e69b5666bed5b783633af21f4130b9d4e3c5d1e Mon Sep 17 00:00:00 2001 From: Nathan Coleman Date: Wed, 22 May 2024 11:09:19 -0400 Subject: [PATCH] Add exportedServices func to templating language doc --- docs/templating-language.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/templating-language.md b/docs/templating-language.md index eb8775bff..4892e5489 100644 --- a/docs/templating-language.md +++ b/docs/templating-language.md @@ -11,6 +11,7 @@ provides the following functions: * [`caRoots`](#caroots) * [`connect`](#connect) * [`datacenters`](#datacenters) + * [`exportedServices`](#exportedservices) * [`file`](#file) * [`key`](#key) * [`keyExists`](#keyexists) @@ -246,6 +247,24 @@ environments where performance is a factor. {{ datacenters true }} ``` +### `exportedServices` + +Query [Consul][consul] for all exported services in a given partition. + +```golang +{{ exportedServices "" }} +``` + +For example: + +```golang +{{- range $svc := (exportedServices "default") }} + {{- range $consumer := .Consumers.Partitions }} + {{- $svc.Service }} is exported to the {{ $consumer }} partition + {{- end }} +{{- end }} +``` + ### `file` Read and output the contents of a local file on disk. If the file cannot be