0

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?

  • Just saw the "type h" at the beginning of my quote here; in the original ctmpl it's NOT included ... no idea how it found its way here ... – Volker Hutten Mar 03 '23 at 10:07

0 Answers0