mirror of
https://github.com/crazy-max/diun.git
synced 2025-12-25 23:03:58 +01:00
Allow customizing Signal notification message
This commit is contained in:
@@ -6,13 +6,17 @@ import (
|
||||
"github.com/crazy-max/diun/v4/pkg/utl"
|
||||
)
|
||||
|
||||
// NotifSignalRestDefaultTemplateBody ...
|
||||
const NotifSignalRestDefaultTemplateBody = `Docker tag {{ .Entry.Image }} which you subscribed to through {{ .Entry.Provider }} provider {{ if (eq .Entry.Status "new") }}is available{{ else }}has been updated{{ end }} on {{ .Entry.Image.Domain }} registry (triggered by {{ .Meta.Hostname }} host).`
|
||||
|
||||
// NotifSignalRest holds SignalRest notification configuration details
|
||||
type NotifSignalRest struct {
|
||||
Endpoint string `yaml:"endpoint,omitempty" json:"endpoint,omitempty" validate:"required"`
|
||||
Number string `yaml:"number,omitempty" json:"method,omitempty" validate:"required"`
|
||||
Recipients []string `yaml:"recipients,omitempty" json:"recipients,omitempty" validate:"omitempty"`
|
||||
Headers map[string]string `yaml:"headers,omitempty" json:"headers,omitempty" validate:"omitempty"`
|
||||
Timeout *time.Duration `yaml:"timeout,omitempty" json:"timeout,omitempty" validate:"required"`
|
||||
Endpoint string `yaml:"endpoint,omitempty" json:"endpoint,omitempty" validate:"required"`
|
||||
Number string `yaml:"number,omitempty" json:"method,omitempty" validate:"required"`
|
||||
Recipients []string `yaml:"recipients,omitempty" json:"recipients,omitempty" validate:"omitempty"`
|
||||
Headers map[string]string `yaml:"headers,omitempty" json:"headers,omitempty" validate:"omitempty"`
|
||||
Timeout *time.Duration `yaml:"timeout,omitempty" json:"timeout,omitempty" validate:"required"`
|
||||
TemplateBody string `yaml:"templateBody,omitempty" json:"templateBody,omitempty" validate:"required"`
|
||||
}
|
||||
|
||||
// GetDefaults gets the default values
|
||||
@@ -26,4 +30,5 @@ func (s *NotifSignalRest) GetDefaults() *NotifSignalRest {
|
||||
func (s *NotifSignalRest) SetDefaults() {
|
||||
s.Timeout = utl.NewDuration(10 * time.Second)
|
||||
s.Endpoint = "http://localhost:8080/v2/send"
|
||||
s.TemplateBody = NotifSignalRestDefaultTemplateBody
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user