config

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagDomains   = "domains"
	FlagEvery     = "every"
	FlagSleep     = "sleep"
	FlagThreshold = "threshold"

	FlagLogFormat = "log-format"
	FlagLogLevel  = "log-level"

	FlagMetricsEnabled = "metrics-enabled"
	FlagMetricsAddress = "metrics-address"

	FlagTelegramChat  = "telegram-chat"
	FlagTelegramToken = "telegram-token"

	FlagGotifyURL   = "gotify-url"
	FlagGotifyToken = "gotify-token"
)
View Source
const EnvPrefix = "WATCH_"

Variables

View Source
var ErrNoDomain = errors.New("no domain was configured")

Functions

func EnvName

func EnvName(name string) string

func InitLog

func InitLog(w io.Writer, level slogx.Level, format slogx.Format)

func NewContext

func NewContext(ctx context.Context, conf *Config) context.Context

func RegisterCompletions

func RegisterCompletions(cmd *cobra.Command)

Types

type Config

type Config struct {
	Domains   []string
	Every     time.Duration
	Sleep     time.Duration
	Threshold []int

	TelegramChat  int64
	TelegramToken string

	GotifyURL   string
	GotifyToken string

	MetricsEnabled bool
	MetricsAddress string
	// contains filtered or unexported fields
}

func FromContext

func FromContext(ctx context.Context) (*Config, bool)

func Load

func Load(cmd *cobra.Command, args []string) (*Config, error)

func New

func New() *Config

func (*Config) InitLog

func (c *Config) InitLog(w io.Writer)

func (*Config) Load

func (c *Config) Load(cmd *cobra.Command, args []string) error

func (*Config) RegisterFlags

func (c *Config) RegisterFlags(cmd *cobra.Command)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL