mirror of
https://github.com/crazy-max/diun.git
synced 2026-01-01 18:47:26 +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:
@@ -1,8 +1,26 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/crazy-max/diun/v3/pkg/utl"
|
||||
)
|
||||
|
||||
// Watch holds data necessary for watch configuration
|
||||
type Watch struct {
|
||||
Workers int `yaml:"workers,omitempty"`
|
||||
Schedule string `yaml:"schedule,omitempty"`
|
||||
FirstCheckNotif *bool `yaml:"first_check_notif,omitempty"`
|
||||
Workers int `yaml:"workers,omitempty" json:"workers,omitempty" validate:"required,min=1"`
|
||||
Schedule string `yaml:"schedule,omitempty" json:"schedule,omitempty" validate:"required"`
|
||||
FirstCheckNotif *bool `yaml:"firstCheckNotif,omitempty" json:"firstCheckNotif,omitempty" validate:"required"`
|
||||
}
|
||||
|
||||
// GetDefaults gets the default values
|
||||
func (s *Watch) GetDefaults() *Watch {
|
||||
n := &Watch{}
|
||||
n.SetDefaults()
|
||||
return n
|
||||
}
|
||||
|
||||
// SetDefaults sets the default values
|
||||
func (s *Watch) SetDefaults() {
|
||||
s.Workers = 10
|
||||
s.Schedule = "0 * * * *"
|
||||
s.FirstCheckNotif = utl.NewFalse()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user