I’m quite new to consul, but trying to get into it. While playing around with services and changes on time with consul-template, we try to use added meta data to the service. The key/value pairs are correctly viewable within the service catalog details, but even with the easiest way to access the meta data an error is thrown:
2023/02/20 17:35:36.135590 [ERR] (cli) /tmp/test.tpl: execute: template: :4:42: executing "" at <.ServiceMeta>: can't evaluate field ServiceMeta in type *dependency.HealthService
The ctmpl is as easy as it can be:
type h{{- range services }}
# {{- .Name }}
{{- range service .Name }}
{{ .Node }} - {{ .Port }} - {{ index .ServiceMeta "serviceUrl" }}
{{- end }}
{{- end }}ere
The service catalog show the values correctly:
ServiceMeta":{"external-source":"nomad","servicePath":"/","serviceUrl":"proxy-test"}
Does anyone has an idea what's wrong or missing?