config

package
v0.0.0-...-e9abcf0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Mail                    MailConfig    `koanf:"mail"`
	Retry                   RetryConfig   `koanf:"retry"`
	DiffMethod              string        `koanf:"diff_method" validate:"required,oneof=git internal"`
	Useragent               string        `koanf:"useragent"`
	Timeout                 time.Duration `koanf:"timeout"`
	Database                string        `koanf:"database" validate:"required"`
	NoErrorMailOnStatusCode []int         `koanf:"no_errormail_on_statuscode" validate:"dive,gte=100,lte=999"`
	RetryOnMatch            []string      `koanf:"retry_on_match"`
	Watches                 []WatchConfig `koanf:"watches" validate:"dive"`
	GracefulTimeout         time.Duration `koanf:"graceful_timeout"`
}

func GetConfig

func GetConfig(f string) (Configuration, error)

type MailConfig

type MailConfig struct {
	Server string `koanf:"server" validate:"required"`
	Port   int    `koanf:"port" validate:"required,gt=0,lte=65535"`
	From   struct {
		Name string `koanf:"name" validate:"required"`
		Mail string `koanf:"mail" validate:"required,email"`
	} `koanf:"from"`
	To       []string      `koanf:"to" validate:"required,dive,email"`
	User     string        `koanf:"user"`
	Password string        `koanf:"password"`
	TLS      bool          `koanf:"tls"`
	StartTLS bool          `koanf:"starttls"`
	SkipTLS  bool          `koanf:"skiptls"`
	Retries  int           `koanf:"retries" validate:"required"`
	Timeout  time.Duration `koanf:"timeout"`
}

type ReplaceConfig

type ReplaceConfig struct {
	Pattern     string `koanf:"pattern" validate:"required"`
	ReplaceWith string `koanf:"replace_with"`
}

type RetryConfig

type RetryConfig struct {
	Count int           `koanf:"count" validate:"required"`
	Delay time.Duration `koanf:"delay" validate:"required"`
}

type WatchConfig

type WatchConfig struct {
	Cron                    string            `koanf:"cron" validate:"required,cron"`
	Name                    string            `koanf:"name" validate:"required"`
	Description             string            `koanf:"description"`
	URL                     string            `koanf:"url" validate:"required,url"`
	Method                  string            `koanf:"method" validate:"required,uppercase"`
	Body                    string            `koanf:"body"`
	Header                  map[string]string `koanf:"header"`
	AdditionalTo            []string          `koanf:"additional_to" validate:"dive,email"`
	NoErrorMailOnStatusCode []int             `koanf:"no_errormail_on_statuscode" validate:"dive,gte=100,lte=999"`
	Disabled                bool              `koanf:"disabled"`
	Pattern                 string            `koanf:"pattern"`
	Replaces                []ReplaceConfig   `koanf:"replaces" validate:"dive"`
	RetryOnMatch            []string          `koanf:"retry_on_match"`
	SkipSofterrorPatterns   bool              `koanf:"skip_soft_error_patterns"`
	JQ                      string            `koanf:"jq"`
	Useragent               string            `koanf:"useragent"`
}

Jump to

Keyboard shortcuts

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