Skip to content

Commit ec95c4a

Browse files
fix: add priority fields to gotify notifications (#678)
Co-authored-by: Johan Larsson <jl311888@gmail.com>
1 parent 8bafe7e commit ec95c4a

File tree

6 files changed

+109
-74
lines changed

6 files changed

+109
-74
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ __debug_bin
55
cmd/backrest/backrest
66
*.exe
77
.DS_Store
8+
.idea/

gen/go/v1/config.pb.go

+82-72
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/hook/types/gotify.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ func (gotifyHandler) Execute(ctx context.Context, h *v1.Hook, vars interface{},
3434
return fmt.Errorf("title template rendering: %w", err)
3535
}
3636

37+
priority := int(g.Priority)
38+
3739
l := runner.Logger(ctx)
3840

3941
message := struct {
@@ -42,7 +44,7 @@ func (gotifyHandler) Execute(ctx context.Context, h *v1.Hook, vars interface{},
4244
Priority int `json:"priority"`
4345
}{
4446
Title: title,
45-
Priority: 5,
47+
Priority: priority,
4648
Message: payload,
4749
}
4850

proto/v1/config.proto

+1
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ message Hook {
213213
string token = 3 [json_name="token"];
214214
string template = 100 [json_name="template"]; // template for the webhook payload.
215215
string title_template = 101 [json_name="titleTemplate"]; // template for the webhook title.
216+
int32 priority = 102 [json_name="priority"]; // priority level for the notification (1-10)
216217
}
217218

218219
message Slack {

0 commit comments

Comments
 (0)