Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultConfigTemplate() string
- func DefaultPath() string
- func EnsureConfigFile(path string) (bool, error)
- func NormalizeSort(s string) (string, error)
- func ParseDuration(s string) (time.Duration, error)
- func WriteConfigFile(path string) error
- type Config
- type DetectionConfig
- type FilterConfig
- type RetentionConfig
- type TrackerConfig
- type UIConfig
Constants ¶
const (
// ConfigEnv is the environment variable for overriding the config file path.
ConfigEnv = "AHT_CONFIG"
)
Variables ¶
var ( ErrMissingUnitSuffix = errors.New("missing unit suffix") ErrInvalidSort = errors.New("invalid ui.sort") ErrInvalidPresence = errors.New("invalid ui.default_presence") ErrInvalidTimeFormat = errors.New("invalid ui.time_format") ErrNegativeAge = errors.New("retention.max_gone_age must be non-negative") ErrNonPositiveInterval = errors.New("tracker.interval must be positive") ErrNegativeGracePeriod = errors.New("tracker.grace_period must be non-negative") ErrConfigIsDirectory = errors.New("config path is a directory") ErrConfigFileTooLarge = errors.New("config file exceeds 1 MiB limit") ErrConfigNotFound = errors.New("config file not found") ErrParseConfig = errors.New("failed to parse config file") ErrLoadDefaults = errors.New("failed to load base defaults") ErrLoadEnv = errors.New("failed to load environment overrides") ErrUnmarshalConfig = errors.New("failed to unmarshal configuration") ErrAccessConfig = errors.New("failed to access config file") ErrInvalidDuration = errors.New("invalid duration") )
Sentinel configuration errors.
Functions ¶
func DefaultConfigTemplate ¶
func DefaultConfigTemplate() string
DefaultConfigTemplate returns a formatted TOML string containing every default option with descriptive comments.
func DefaultPath ¶
func DefaultPath() string
DefaultPath returns the default path to the user's config file.
func EnsureConfigFile ¶
EnsureConfigFile ensures that a configuration file exists at path. If path is empty, DefaultPath() is used. If the file already exists, it returns created=false, nil. If the file does not exist, it creates the parent directories and writes DefaultConfigTemplate() with 0o644 permissions, returning created=true, nil.
func NormalizeSort ¶
NormalizeSort validates and normalizes sort key names.
func ParseDuration ¶
ParseDuration parses duration strings including day suffixes (e.g. "7d", "24h", "10s").
func WriteConfigFile ¶
WriteConfigFile writes the default configuration template to path, creating parent directories if needed. It overwrites any existing file at path.
Types ¶
type Config ¶
type Config struct {
UI UIConfig `json:"ui" koanf:"ui" toml:"ui"`
Retention RetentionConfig `json:"retention" koanf:"retention" toml:"retention"`
Filter FilterConfig `json:"filter" koanf:"filter" toml:"filter"`
Tracker TrackerConfig `json:"tracker" koanf:"tracker" toml:"tracker"`
Detection DetectionConfig `json:"detection" koanf:"detection" toml:"detection"`
}
type DetectionConfig ¶
type DetectionConfig struct {
ManifestsDir string `json:"manifests_dir,omitempty" koanf:"manifests_dir" toml:"manifests_dir"`
ScreenInspection *bool `json:"screen_inspection,omitempty" koanf:"screen_inspection" toml:"screen_inspection"`
}
DetectionConfig controls agent and screen inspection defaults.
type FilterConfig ¶
type FilterConfig struct {
IgnoreHarnesses []string `json:"ignore_harnesses,omitempty" koanf:"ignore_harnesses" toml:"ignore_harnesses"`
IgnorePaths []string `json:"ignore_paths,omitempty" koanf:"ignore_paths" toml:"ignore_paths"`
}
FilterConfig controls default session visibility exclusions.
type RetentionConfig ¶
type RetentionConfig struct {
AutoClean *bool `json:"auto_clean,omitempty" koanf:"auto_clean" toml:"auto_clean"`
MaxGoneAge string `json:"max_gone_age,omitempty" koanf:"max_gone_age" toml:"max_gone_age"`
}
RetentionConfig controls state retention and tombstone cleanup defaults.
type TrackerConfig ¶
type TrackerConfig struct {
Interval string `json:"interval,omitempty" koanf:"interval" toml:"interval"`
GracePeriod string `json:"grace_period,omitempty" koanf:"grace_period" toml:"grace_period"`
Quiet *bool `json:"quiet,omitempty" koanf:"quiet" toml:"quiet"`
}
TrackerConfig controls background observer behavior.
type UIConfig ¶
type UIConfig struct {
DefaultPresence string `json:"default_presence,omitempty" koanf:"default_presence" toml:"default_presence"`
Sort string `json:"sort,omitempty" koanf:"sort" toml:"sort"`
SortDesc *bool `json:"sort_desc,omitempty" koanf:"sort_desc" toml:"sort_desc"`
AbsoluteTime *bool `json:"absolute_time,omitempty" koanf:"absolute_time" toml:"absolute_time"`
TimeFormat string `json:"time_format,omitempty" koanf:"time_format" toml:"time_format"`
}
UIConfig controls terminal and table display defaults.