Skip to content

Commit

Permalink
Add exportedServices func to templating language doc
Browse files Browse the repository at this point in the history
  • Loading branch information
nathancoleman committed May 22, 2024
1 parent 89494e7 commit 6e69b56
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/templating-language.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ provides the following functions:
* [`caRoots`](#caroots)
* [`connect`](#connect)
* [`datacenters`](#datacenters)
* [`exportedServices`](#exportedservices)
* [`file`](#file)
* [`key`](#key)
* [`keyExists`](#keyexists)
Expand Down Expand Up @@ -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 "<PARTITION>" }}
```

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
Expand Down

0 comments on commit 6e69b56

Please sign in to comment.