-
In my configuration file, I have a few Here's part of my profile: {{ define "hook_discord" }}
method = "POST"
url = {{ template "discord_webhook_url" . }}
body-template = "templates/discord-webhook.json"
{{ end }}
{{ define "hook_discord_fail" }}
method = "POST"
url = {{ template "discord_webhook_url" . }}
body-template = "templates/discord-webhook-fail.json"
{{ end }}
# [base.backup.send-after]
# {{ template "hook_discord" . }}
# [[base.backup.send-after.headers]]
# {{ template "hook_header_json" . }}
[base.backup.send-after-fail]
{{ template "hook_discord_fail" . }}
[[base.backup.send-after-fail.headers]]
{{ template "hook_header_json" . }} And here's the output from trace: # [base.backup.send-after]
#
method = "POST"
url = "<hidden>"
body-template = "templates/discord-webhook.json"
# [[base.backup.send-after.headers]]
#
name = "Content-Type"
value = "application/json"
[base.backup.send-after-fail]
method = "POST"
url = "<hidden>"
body-template = "templates/discord-webhook-fail.json"
[[base.backup.send-after-fail.headers]]
name = "Content-Type"
value = "application/json" |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @http403, Templates don't follow TOML or YAML markup (the are one level above). You can also do the following:
And then set DEBUG to conditionally enable the hook:
(You can also place the if conditions inside your defines and leave the template calls as they are) |
Beta Was this translation helpful? Give feedback.
Hi @http403,
Templates don't follow TOML or YAML markup (the are one level above).
Try:
{{ /* template "hook_discord" . */ }}
to disable a template call.You can also do the following:
And then set DEBUG to conditionally enable the hook:
(You can also place the if conditions inside your defines and leave the template calls as they are)