Skip to content

Gomplate erroring out #2031

Closed Answered by tewfik-ghariani
nbtolambe asked this question in Q&A
Discussion options

You must be logged in to vote

The alerting template syntax is meddling with the gomplate expected syntax

There are a couple of options in this case:

  1. Escape those curly braces by making gomplate render literal strings via {{ "{{" }}
title: |-
  [{{ "{{" }} .Status | toUpper {{ "}}" }}{{ "{{" }} if eq .Status "firing" {{ "}}" }}

  1. Alter the separator of gomplate itself and keep the rest as it is
gomplate .. --left-delim "<<" --right-delim ">>"

( or via GOMPLATE_LEFT_DELIM and GOMPLATE_RIGHT_DELIM environment variables )

Then update the datasource line accordingly

  - api_url: '<< (ds "config" | json).slack_api_url >>'

  1. Move out the template to an external file and then "Read" it via gomplate
    [{{ .Status | toUpp…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by hairyhenderson
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants