config

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package config provides YAML configuration loading and validation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ListenAddr       string             `yaml:"listenAddr"`
	MetricsPath      string             `yaml:"metricsPath"`
	HistoryDB        string             `yaml:"historyDB"`
	SPIFFESocket     string             `yaml:"spiffeSocket"`
	OTelEndpoint     string             `yaml:"otelEndpoint"`
	ClusterName      string             `yaml:"clusterName"`
	Namespaces       []string           `yaml:"namespaces"`
	External         []ExternalTarget   `yaml:"external"`
	Remotes          []RemoteCluster    `yaml:"remotes"`
	CTDomains        []string           `yaml:"ctDomains"`
	CTAllowedIssuers []string           `yaml:"ctAllowedIssuers"`
	Notifications    NotificationConfig `yaml:"notifications"`
	RefreshEvery     time.Duration      `yaml:"refreshEvery"`
	WarnBefore       time.Duration      `yaml:"warnBefore"`
	CritBefore       time.Duration      `yaml:"critBefore"`
}

Config holds trustwatch runtime configuration.

func Defaults

func Defaults() *Config

Defaults returns a Config with sane defaults.

func Load

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

Load reads a YAML config file and merges with defaults.

func (*Config) Validate added in v0.1.2

func (c *Config) Validate() error

Validate checks that the config values are sane.

type ExternalTarget

type ExternalTarget struct {
	URL string `yaml:"url"` // https://host:port or tcp://host:port?sni=name
}

ExternalTarget is an explicit TLS endpoint to probe.

type NotificationConfig added in v0.1.4

type NotificationConfig struct {
	Webhooks   []WebhookConfig `yaml:"webhooks"`
	Severities []string        `yaml:"severities"`
	Cooldown   time.Duration   `yaml:"cooldown"`
	Enabled    bool            `yaml:"enabled"`
}

NotificationConfig controls how notifications are sent.

type RemoteCluster added in v0.2.0

type RemoteCluster struct {
	Name string `yaml:"name"` // cluster label
	URL  string `yaml:"url"`  // base URL of remote trustwatch (e.g. http://trustwatch.staging:8080)
}

RemoteCluster describes a remote trustwatch instance to federate.

type WebhookConfig added in v0.1.4

type WebhookConfig struct {
	URL          string `yaml:"url"`
	Type         string `yaml:"type"`         // "slack", "generic", "pagerduty", or "grafana"
	RoutingKey   string `yaml:"routingKey"`   // PagerDuty Events API v2 routing key
	APIKey       string `yaml:"apiKey"`       // Grafana API key (Bearer token)
	DashboardUID string `yaml:"dashboardUID"` // Grafana dashboard UID (optional)
}

WebhookConfig describes a notification webhook endpoint.

Jump to

Keyboard shortcuts

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