config

package
v0.23.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Receivers  map[string]ReceiverConfig  `yaml:"receivers"`  // Receiver definitions.
	Heartbeats map[string]HeartbeatConfig `yaml:"heartbeats"` // Heartbeat definitions.
	History    HistoryConfig              `yaml:"history"`    // History configuration.
}

Config defines the YAML configuration structure.

func Load added in v0.22.0

func Load(path string) (*Config, error)

Load reads and validates a YAML configuration file.

func LoadWithOptions added in v0.22.0

func LoadWithOptions(path string, opts LoadOptions) (*Config, error)

LoadWithOptions reads and validates a YAML configuration file.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks for missing or invalid config values.

type EmailConfig added in v0.22.0

type EmailConfig struct {
	Host               string            `yaml:"host"`                            // SMTP host.
	Port               int               `yaml:"port"`                            // SMTP port.
	User               string            `yaml:"user,omitempty"`                  // SMTP user.
	Pass               string            `yaml:"pass,omitempty"`                  // SMTP password.
	From               string            `yaml:"from"`                            // Sender address.
	To                 []string          `yaml:"to"`                              // Recipient list.
	Headers            map[string]string `yaml:"headers,omitempty"`               // Optional email headers.
	StartTLS           bool              `yaml:"starttls"`                        // Enable STARTTLS.
	SSL                bool              `yaml:"ssl"`                             // Use implicit TLS.
	InsecureSkipVerify bool              `yaml:"insecure_skip_verify"`            // Skip TLS verification.
	Template           string            `yaml:"template,omitempty"`              // Email body template path.
	SubjectTmpl        string            `yaml:"subject_override_tmpl,omitempty"` // Email subject template override.
}

EmailConfig configures SMTP delivery.

type HeartbeatConfig added in v0.22.0

type HeartbeatConfig struct {
	Title           string        `yaml:"title,omitempty"`             // Human-friendly title.
	Interval        time.Duration `yaml:"interval"`                    // Expected interval between heartbeats.
	LateAfter       time.Duration `yaml:"late_after"`                  // Late window duration.
	AlertOnRecovery *bool         `yaml:"alert_on_recovery,omitempty"` // Enable recovery alerts.
	AlertOnLate     *bool         `yaml:"alert_on_late,omitempty"`     // Enable late alerts.
	SubjectTmpl     string        `yaml:"subject_tmpl,omitempty"`      // Default subject template.
	WebhookTemplate string        `yaml:"webhook_template,omitempty"`  // Default webhook template path.
	EmailTemplate   string        `yaml:"email_template,omitempty"`    // Default email template path.
	Receivers       []string      `yaml:"receivers"`                   // Receiver names for this heartbeat.
}

HeartbeatConfig defines a monitored heartbeat and its receivers.

type HistoryConfig added in v0.22.0

type HistoryConfig struct {
	Size   int `yaml:"size"`   // Number of events to keep.
	Buffer int `yaml:"buffer"` // Async buffer size for history events.
}

HistoryConfig defines in-memory history settings.

type LoadOptions added in v0.22.0

type LoadOptions struct {
	StrictEnv bool // Whether unresolved env vars should error.
}

LoadOptions controls config loading behavior.

type ReceiverConfig added in v0.22.0

type ReceiverConfig struct {
	Webhooks []WebhookConfig `yaml:"webhooks,omitempty"` // Webhook delivery settings.
	Emails   []EmailConfig   `yaml:"emails,omitempty"`   // Email delivery settings.
	Retry    RetryConfig     `yaml:"retry,omitempty"`    // Per-receiver retry policy.
	Vars     map[string]any  `yaml:"vars,omitempty"`     // Additional template variables.
}

ReceiverConfig describes where notifications are delivered.

type RetryConfig added in v0.22.0

type RetryConfig struct {
	Count int           `yaml:"count"` // Number of retry attempts.
	Delay time.Duration `yaml:"delay"` // Delay between retries.
}

RetryConfig defines retry behavior for a receiver.

type WebhookConfig added in v0.22.0

type WebhookConfig struct {
	URL                string              `yaml:"url"`                             // Destination URL.
	Method             string              `yaml:"method,omitempty"`                // HTTP method.
	Headers            map[string]string   `yaml:"headers,omitempty"`               // Optional headers.
	Timeout            time.Duration       `yaml:"timeout,omitempty"`               // HTTP timeout.
	InsecureSkipVerify bool                `yaml:"insecure_skip_verify,omitempty"`  // Skip TLS certificate verification.
	Template           string              `yaml:"template,omitempty"`              // Webhook payload template path.
	SubjectTmpl        string              `yaml:"subject_override_tmpl,omitempty"` // Subject template override.
	LogResponse        webhook.LogResponse `yaml:"log_response,omitempty"`          // Successful response logging mode.
	ResponseBodyLimit  int                 `yaml:"response_body_limit,omitempty"`   // Maximum response body bytes to read.
}

WebhookConfig configures webhook delivery.

Jump to

Keyboard shortcuts

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