config

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

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.
	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.
	Headers     map[string]string `yaml:"headers,omitempty"`               // Optional headers.
	Template    string            `yaml:"template,omitempty"`              // Webhook payload template path.
	SubjectTmpl string            `yaml:"subject_override_tmpl,omitempty"` // Subject template override.
}

WebhookConfig configures webhook delivery.

Jump to

Keyboard shortcuts

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