mirror of
https://github.com/crazy-max/diun.git
synced 2025-01-27 01:08:50 +00:00
5d583809a0
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
33 lines
1.3 KiB
Go
33 lines
1.3 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/crazy-max/diun/v4/pkg/utl"
|
|
)
|
|
|
|
// NotifGotify holds gotify notification configuration details
|
|
type NotifGotify struct {
|
|
Endpoint string `yaml:"endpoint,omitempty" json:"endpoint,omitempty" validate:"required"`
|
|
Token string `yaml:"token,omitempty" json:"token,omitempty" validate:"omitempty"`
|
|
TokenFile string `yaml:"tokenFile,omitempty" json:"tokenFile,omitempty" validate:"omitempty,file"`
|
|
Priority int `yaml:"priority,omitempty" json:"priority,omitempty" validate:"omitempty,min=0"`
|
|
Timeout *time.Duration `yaml:"timeout,omitempty" json:"timeout,omitempty" validate:"required"`
|
|
TemplateTitle string `yaml:"templateTitle,omitempty" json:"templateTitle,omitempty" validate:"required"`
|
|
TemplateBody string `yaml:"templateBody,omitempty" json:"templateBody,omitempty" validate:"required"`
|
|
}
|
|
|
|
// GetDefaults gets the default values
|
|
func (s *NotifGotify) GetDefaults() *NotifGotify {
|
|
n := &NotifGotify{}
|
|
n.SetDefaults()
|
|
return n
|
|
}
|
|
|
|
// SetDefaults sets the default values
|
|
func (s *NotifGotify) SetDefaults() {
|
|
s.Priority = 1
|
|
s.Timeout = utl.NewDuration(10 * time.Second)
|
|
s.TemplateTitle = NotifDefaultTemplateTitle
|
|
s.TemplateBody = NotifDefaultTemplateBody
|
|
}
|