mirror of
https://github.com/crazy-max/diun.git
synced 2025-01-27 01:08:50 +00:00
fc64b132ff
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
30 lines
1 KiB
Go
30 lines
1 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/crazy-max/diun/v4/pkg/utl"
|
|
)
|
|
|
|
// NotifDiscord holds Discord notification configuration details
|
|
type NotifDiscord struct {
|
|
WebhookURL string `yaml:"webhookURL,omitempty" json:"webhookURL,omitempty" validate:"required"`
|
|
Mentions []string `yaml:"mentions,omitempty" json:"mentions,omitempty"`
|
|
RenderFields *bool `yaml:"renderFields,omitempty" json:"renderFields,omitempty" validate:"required"`
|
|
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
|
|
func (s *NotifDiscord) GetDefaults() *NotifDiscord {
|
|
n := &NotifDiscord{}
|
|
n.SetDefaults()
|
|
return n
|
|
}
|
|
|
|
// SetDefaults sets the default values
|
|
func (s *NotifDiscord) SetDefaults() {
|
|
s.RenderFields = utl.NewTrue()
|
|
s.Timeout = utl.NewDuration(10 * time.Second)
|
|
s.TemplateBody = NotifDefaultTemplateBody
|
|
}
|