mirror of
https://github.com/amir20/dozzle.git
synced 2026-06-23 04:10:12 +00:00
a79ffdaf50
Co-authored-by: Dhaval Patel <dhavu262@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
64 lines
1.4 KiB
TypeScript
64 lines
1.4 KiB
TypeScript
export type PayloadFormat = "slack" | "discord" | "ntfy" | "custom";
|
|
|
|
export const PAYLOAD_TEMPLATES: Record<PayloadFormat, string> = {
|
|
slack: JSON.stringify(
|
|
{
|
|
text: "{{ .Container.Name }}",
|
|
blocks: [
|
|
{
|
|
type: "section",
|
|
text: {
|
|
type: "mrkdwn",
|
|
text: "*{{ .Container.Name }}*\n{{ .Detail }}",
|
|
},
|
|
},
|
|
{
|
|
type: "context",
|
|
elements: [
|
|
{
|
|
type: "mrkdwn",
|
|
text: "Host: {{ .Container.HostName }} | Image: {{ .Container.Image }}",
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
null,
|
|
2,
|
|
),
|
|
discord: JSON.stringify(
|
|
{
|
|
content: "{{ .Container.Name }}",
|
|
embeds: [
|
|
{
|
|
title: "{{ .Container.Name }}",
|
|
description: "{{ .Detail }}",
|
|
fields: [
|
|
{ name: "Host", value: "{{ .Container.HostName }}", inline: true },
|
|
{ name: "Image", value: "{{ .Container.Image }}", inline: true },
|
|
],
|
|
},
|
|
],
|
|
},
|
|
null,
|
|
2,
|
|
),
|
|
ntfy: JSON.stringify(
|
|
{
|
|
topic: "dozzle-{{ .Container.HostName }}",
|
|
title: "{{ .Container.Name }}",
|
|
message: "{{ .Detail }}",
|
|
},
|
|
null,
|
|
2,
|
|
),
|
|
custom: JSON.stringify(
|
|
{
|
|
container: "{{ .Container.Name }}",
|
|
message: "{{ .Detail }}",
|
|
},
|
|
null,
|
|
2,
|
|
),
|
|
};
|