mirror of
https://github.com/crazy-max/diun.git
synced 2025-12-25 23:03:58 +01:00
Configuration transposed into environment variables (#82)
Configuration file not required anymore DIUN_DB env var renamed DIUN_DB_PATH Only accept duration as timeout value (10 becomes 10s) Add getting started doc Enhanced documentation Add note about test notifications (#79) Improve configuration management Fix telegram init All fields in configuration now camelCased Improve configuration validation Update doc Update FAQ Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
28
internal/model/notif_webhook.go
Normal file
28
internal/model/notif_webhook.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/crazy-max/diun/v3/pkg/utl"
|
||||
)
|
||||
|
||||
// NotifWebhook holds webhook notification configuration details
|
||||
type NotifWebhook struct {
|
||||
Endpoint string `yaml:"endpoint,omitempty" json:"endpoint,omitempty" validate:"required"`
|
||||
Method string `yaml:"method,omitempty" json:"method,omitempty" validate:"required"`
|
||||
Headers map[string]string `yaml:"headers,omitempty" json:"headers,omitempty" validate:"omitempty"`
|
||||
Timeout *time.Duration `yaml:"timeout,omitempty" json:"timeout,omitempty" validate:"required"`
|
||||
}
|
||||
|
||||
// GetDefaults gets the default values
|
||||
func (s *NotifWebhook) GetDefaults() *NotifWebhook {
|
||||
n := &NotifWebhook{}
|
||||
n.SetDefaults()
|
||||
return n
|
||||
}
|
||||
|
||||
// SetDefaults sets the default values
|
||||
func (s *NotifWebhook) SetDefaults() {
|
||||
s.Method = "GET"
|
||||
s.Timeout = utl.NewDuration(10 * time.Second)
|
||||
}
|
||||
Reference in New Issue
Block a user