Documentation
¶
Overview ¶
Package config loads and saves ~/.config/bentoo/config.yaml: the overlay, git identity, autoupdate, validation, UI, notice and tray settings.
Every default comes from a getter rather than a struct literal, so an absent, partial or nil block resolves the same way. Unknown keys never stop a load: a strict second decode reports them as warnings. Secrets are not read from this file; package secrets resolves them.
Index ¶
- Constants
- Variables
- func AutoupdateDir() (string, error)
- func ConfigPaths() ([]string, error)
- func DefaultConfigPath() (string, error)
- func DefaultPackageOverrides() map[string]ValidatePackageOverride
- func FindConfigPath() (string, error)
- func ParseGitconfigContent(r interface{ ... }) (user, email string, err error)
- type AutoupdateConfig
- type CPUMonitor
- type CPUMonitorConfig
- type Config
- type DiskMonitor
- type DiskMonitorConfig
- type EmergeMonitor
- type EmergeMonitorConfig
- type GLSAMonitor
- type GLSAMonitorConfig
- type GitConfig
- type LLMConfig
- type MemoryMonitor
- type MemoryMonitorConfig
- type Monitors
- type MonitorsConfig
- type NetworkMonitor
- type NetworkMonitorConfig
- type NoticeConfig
- type OverlayConfig
- type OverlayValidationError
- type OverlayValidationResult
- type ReadonlyMonitor
- type ReadonlyMonitorConfig
- type RepoConfig
- type ReviewConfig
- type SearchConfig
- type SmartMonitor
- type SmartMonitorConfig
- type SyncMonitor
- type SyncMonitorConfig
- type TrayConfig
- type UIConfig
- type UnitsMonitor
- type UnitsMonitorConfig
- type UpdatesMonitor
- type UpdatesMonitorConfig
- type ValidateConfig
- func (c *ValidateConfig) FixOnFailureDisabled() bool
- func (c *ValidateConfig) GetDepthForClass(class string) string
- func (c *ValidateConfig) GetFixOnFailure() bool
- func (c *ValidateConfig) GetRequireIsolation() bool
- func (c *ValidateConfig) GetRequireProof() bool
- func (c *ValidateConfig) GetReview() bool
- func (c *ValidateConfig) GetTimeout() time.Duration
- func (c *ValidateConfig) OverrideErrors() []error
- func (c *ValidateConfig) ReviewDisabled() bool
- type ValidateDepths
- type ValidatePackageOverride
- type VendorConfig
Constants ¶
const ( DefaultDepthRevision = "options" DefaultDepthPatch = "options" DefaultDepthSeries = "configure" DefaultDepthMajor = "configure" )
The default depth for each bump class. revision and patch are the cheap, frequent bumps and stop at the static gate; series and major cross a boundary upstream chose to mark, so they earn a configure. No class defaults to compile — see ValidateConfig's doc comment.
THEY DID NOT MOVE WHEN THE INSTALL RUNG WAS ADDED, and that is a decision rather than an omission. Adding a rung is a capability; promoting a default is a cost decision belonging to whoever pays for the hours, and an operator who upgrades the binary without reading the changelog must find yesterday's sweep costing what it cost yesterday. `install` is reached by --depth=install or by an explicit key here, never by default.
const ( // DefaultTrayInterval is how often bentoo-tray checks the feed when // tray.interval is absent. DefaultTrayInterval = 6 * time.Hour // MinTrayInterval is the floor tray.interval is clamped to. MinTrayInterval = time.Hour // DefaultTrayFeedURL is the notices feed bentoo-tray reads by default. DefaultTrayFeedURL = "https://obentoo.org/notices.json" )
const ( DefaultMonitorSampleInterval = 30 * time.Second MinMonitorSampleInterval = 10 * time.Second DefaultMonitorReminder = time.Hour MinMonitorReminder = 15 * time.Minute DefaultDiskWarnPercent = 10.0 DefaultDiskWarnFree uint64 = 20 << 30 DefaultDiskCritPercent = 2.0 DefaultDiskCritFree uint64 = 2 << 30 DefaultDiskSustain = time.Minute DefaultMemoryWarnPercent = 10.0 DefaultMemoryCritPercent = 5.0 DefaultMemoryCritSwapPercent = 10.0 DefaultMemoryPSIFullCrit = 10.0 DefaultMemorySustain = 2 * time.Minute DefaultCPUWarnPSI = 80.0 DefaultCPUClearPSI = 70.0 DefaultCPUSustain = 5 * time.Minute DefaultNetworkDownAfter = 30 * time.Second DefaultNetworkDownAfterStartup = time.Minute DefaultNetworkBackAfter = 10 * time.Second )
Defaults and limits of the tray.monitors keys. Sizes are bytes.
const ( // DefaultSyncMaxAge is how old a repository's last sync may grow before // the sync monitor reports it. DefaultSyncMaxAge = 7 * 24 * time.Hour // MinSyncMaxAge is the shortest tray.monitors.sync.max_age accepted. MinSyncMaxAge = 24 * time.Hour )
const DefaultCacheTTL = 3600
DefaultCacheTTL is the default cache TTL in seconds (1 hour)
const DefaultEmergeLog = "/var/log/emerge.log"
DefaultEmergeLog is the emerge log the emerge monitor follows.
const DefaultHTTPTimeout = 30
DefaultHTTPTimeout is the default per-request HTTP timeout in seconds.
const DefaultReviewTimeout = 300
DefaultReviewTimeout is the default budget for one `overlay compare` divergence review, in seconds.
This, not internal/autoupdate's DefaultClaudeCodeTimeout, governs the review: the client uses any positive caller budget and GetTimeout never returns anything else. Tune this constant, or the key that defaults to it.
300 is measured: `bentoo overlay compare --realign` over a 268-package overlay with the budget raised to 1800s gave 126 invocations, 122 successes, none reaching the deadline. The successes spread, in seconds:
min 7.4 · p50 14.3 · p90 64.8 · p95 76.6 · p99 112.0 · max 124.6
The old 120s cut off the 124.6s review. 300 is 2.4x the largest success, headroom for a skewed long tail; it stays finite so a hung review still ends. It is NOT established that 300 fixes the earlier case of undeclared- divergence reviews all dying at the deadline: the run was mostly cheap realignment reviews, and the duration log does not record the package.
const DefaultValidateTimeout = 3600
DefaultValidateTimeout is the default per-agent budget in seconds (1 hour), bounding the reviewer and the build fixer.
const DefaultVendorHost = "distfiles.obentoo.org"
DefaultVendorHost is the distfiles host the overlay serves its Go vendor tarballs from; it is the host list when autoupdate.vendor.hosts is absent.
Variables ¶
var ( ErrOverlayPathNotSet = errors.New("overlay path is not configured") ErrOverlayPathNotFound = errors.New("overlay path does not exist") ErrOverlayInvalidStructure = errors.New("overlay structure is invalid") ErrGitUserNotConfigured = errors.New("git user is not configured: set user.name and user.email in ~/.gitconfig or bentoo config") // ErrOverrideMissingReason marks a per-package validation override that // states a depth but not why. It is a sentinel so a caller can // match the class of problem; the wrapped message always names the package. ErrOverrideMissingReason = errors.New("per-package validate override has no reason") )
Functions ¶
func AutoupdateDir ¶
AutoupdateDir is where `overlay autoupdate` and `overlay analyze` keep their state: the pending list, the version cache, retained logs and staged trees. It sits beside config.yaml and follows the same rule — $XDG_CONFIG_HOME, else ~/.config — so a temporary XDG_CONFIG_HOME that points a run at another overlay also keeps that run's state away from the real one. It used to be hard-coded under $HOME, and a scratch run's pending entries landed in the user's live pending.json.
func ConfigPaths ¶
ConfigPaths returns all possible config file paths in priority order 1. ~/.config/bentoo/config.yaml (XDG standard - priority) 2. ~/.bentoo/config.yaml (legacy fallback)
func DefaultConfigPath ¶
DefaultConfigPath returns the default config file path (XDG standard)
func DefaultPackageOverrides ¶
func DefaultPackageOverrides() map[string]ValidatePackageOverride
DefaultPackageOverrides returns the per-package overrides bentoolkit ships with, as a fresh map the caller may keep and edit.
These are the packages whose from-source build costs hours that an unattended sweep would otherwise spend without being asked. They are ORDINARY overrides carrying ordinary reasons — not a hardcoded tier list — so the reason is reported beside the outcome and is required, exactly as for anything an operator writes, and so an operator overrides one by writing the same package key with a depth and a reason of their own.
func FindConfigPath ¶
FindConfigPath returns the first existing config file path Returns the default path if no config file exists yet
Types ¶
type AutoupdateConfig ¶
type AutoupdateConfig struct {
CacheTTL int `yaml:"cache_ttl"` // Cache TTL in seconds (default: 3600)
HTTPTimeout int `yaml:"http_timeout"` // Per-request HTTP timeout in seconds (default: 30)
LLM LLMConfig `yaml:"llm"` // LLM provider configuration
Search SearchConfig `yaml:"search"` // Search provider configuration
// Distdir is the directory `pkgdev manifest` is given as --distdir on the
// autoupdate path — the same name and the same meaning the `overlay
// manifest` command's --distdir already has. Unset (the
// default) means the host's own DISTDIR is used, which is what
// `portageq distdir` reports.
Distdir string `yaml:"distdir,omitempty"`
// DistfilesCache is the read-only distfiles cache consulted before a
// download, again under the name `overlay manifest` already uses.
// Unset means the built-in default (/var/cache/distfiles).
// The cache is only ever read from: files are symlinked into the working
// distdir, never written back.
DistfilesCache string `yaml:"distfiles_cache,omitempty"`
// Validate is the staged-bump validation policy. It is nested
// here rather than at the top level because everything it governs happens
// during an autoupdate.
Validate ValidateConfig `yaml:"validate,omitempty"`
// Review is the budget one `overlay compare` divergence review runs
// under. It is nested here rather than in a top-level `compare:`
// block — where the name would fit better — because a top-level block has
// to be mirrored into probeConfig by hand and a nested one inherits that
// mirror for free. ReviewConfig carries the whole of that reasoning.
Review ReviewConfig `yaml:"review,omitempty"`
// Vendor governs the Go vendor-tarball step: which distfile hosts the
// applier may regenerate a missing vendor tarball for, and the command that
// publishes one.
Vendor VendorConfig `yaml:"vendor,omitempty"`
}
AutoupdateConfig holds autoupdate-specific settings
func (*AutoupdateConfig) GetCacheTTL ¶
func (c *AutoupdateConfig) GetCacheTTL() int
GetCacheTTL returns the cache TTL in seconds, using the default if not configured.
func (*AutoupdateConfig) GetDistdir ¶
func (c *AutoupdateConfig) GetDistdir() string
GetDistdir returns autoupdate.distdir with surrounding whitespace removed, or "" when the key is unset.
Whitespace is stripped rather than preserved because this value becomes a DIRECTORY that distfiles are downloaded into: " /var/cache/distfiles" is a typo in a hand-edited YAML file, not a request for a directory whose name begins with a space. "" is returned unchanged and means "not configured" — the caller then falls through to the next rung of the precedence, never to a path this function invented.
func (*AutoupdateConfig) GetDistfilesCache ¶
func (c *AutoupdateConfig) GetDistfilesCache() string
GetDistfilesCache returns autoupdate.distfiles_cache with surrounding whitespace removed, or "" when the key is unset.
Unlike GetCacheTTL and GetHTTPTimeout this deliberately does NOT substitute a default: the flag layer owns that decision, because there the difference between "unset" and "set to the empty string" is observable (pflag's Changed) and the empty string is the documented way to DISABLE the cache. Answering with a default here would make a config file unable to express anything the flag can.
func (*AutoupdateConfig) GetHTTPTimeout ¶
func (c *AutoupdateConfig) GetHTTPTimeout() int
GetHTTPTimeout returns the per-request HTTP timeout in seconds, using the default when unset or non-positive. This is the cap on a single outbound attempt; the autoupdate checker derives the overall per-operation budget from it so the retry attempts fit within the deadline.
type CPUMonitor ¶ added in v0.37.0
CPUMonitor holds the CPU pressure thresholds; ClearPSI is always below WarnPSI when WarnPSI is above zero.
type CPUMonitorConfig ¶ added in v0.37.0
type CPUMonitorConfig struct {
Enabled yaml.Node `yaml:"enabled,omitempty"`
WarnPSI yaml.Node `yaml:"warn_psi,omitempty"`
ClearPSI yaml.Node `yaml:"clear_psi,omitempty"`
Sustain yaml.Node `yaml:"sustain,omitempty"`
}
CPUMonitorConfig is the raw `tray.monitors.cpu:` block.
type Config ¶
type Config struct {
Overlay OverlayConfig `yaml:"overlay"`
Git GitConfig `yaml:"git"`
Autoupdate AutoupdateConfig `yaml:"autoupdate,omitempty"`
Repositories map[string]*RepoConfig `yaml:"repositories,omitempty"`
// UI is the global rendering policy. It sits at the top level
// rather than under `autoupdate` because it governs every command that
// reports progress — `autoupdate` and `overlay manifest` today — and a key
// that has to be repeated per command is a key that ends up set in one
// place and forgotten in the other.
UI UIConfig `yaml:"ui,omitempty"`
// Notice configures `bentoo notice`.
Notice NoticeConfig `yaml:"notice,omitempty"`
// Tray configures bentoo-tray.
Tray TrayConfig `yaml:"tray,omitempty"`
}
Config represents the application configuration
func Load ¶
Load reads configuration from the first available config file Priority: ~/.config/bentoo/config.yaml > ~/.bentoo/config.yaml
func (*Config) GetGitUser ¶
GetGitUser returns the git user name and email. It first tries to read from ~/.gitconfig, then falls back to bentoo config.
func (*Config) GetNoticeSitePath ¶
GetNoticeSitePath returns notice.site_path with a leading `~/` expanded to the home directory, or "" when the key is unset. Only a leading `~/` is expanded: `~other/` names another user's home and a tilde anywhere else is an ordinary character, so both are returned unchanged.
func (*Config) GetOverlayPath ¶
GetOverlayPath returns the validated overlay path
func (*Config) GetOverlayPathNoValidation ¶
GetOverlayPathNoValidation returns the overlay path without structure validation. Use this when you need the path but don't require a valid overlay structure (e.g., for overlay init command).
type DiskMonitor ¶ added in v0.37.0
type DiskMonitor struct {
Enabled bool
Paths []string
WarnPercent float64
WarnFree uint64
CritPercent float64
CritFree uint64
Sustain time.Duration
}
DiskMonitor holds the disk thresholds. Paths is empty unless configured; the caller resolves the default paths. Percentages are of the filesystem size; WarnFree and CritFree are bytes.
type DiskMonitorConfig ¶ added in v0.37.0
type DiskMonitorConfig struct {
Enabled yaml.Node `yaml:"enabled,omitempty"`
Paths yaml.Node `yaml:"paths,omitempty"`
WarnPercent yaml.Node `yaml:"warn_percent,omitempty"`
WarnFree yaml.Node `yaml:"warn_free,omitempty"`
CritPercent yaml.Node `yaml:"crit_percent,omitempty"`
CritFree yaml.Node `yaml:"crit_free,omitempty"`
Sustain yaml.Node `yaml:"sustain,omitempty"`
}
DiskMonitorConfig is the raw `tray.monitors.disk:` block.
type EmergeMonitor ¶ added in v0.37.0
EmergeMonitor names the emerge log whose failed builds are announced.
type EmergeMonitorConfig ¶ added in v0.37.0
type EmergeMonitorConfig struct {
Enabled yaml.Node `yaml:"enabled,omitempty"`
Log yaml.Node `yaml:"log,omitempty"`
}
EmergeMonitorConfig is the raw `tray.monitors.emerge:` block.
type GLSAMonitor ¶ added in v0.37.0
type GLSAMonitor struct {
Enabled bool
}
GLSAMonitor switches the security advisory monitor.
type GLSAMonitorConfig ¶ added in v0.37.0
GLSAMonitorConfig is the raw `tray.monitors.glsa:` block.
type LLMConfig ¶
type LLMConfig struct {
Provider string `yaml:"provider"` // LLM provider name (e.g., "claude")
APIKeyEnv string `yaml:"api_key_env"` // Environment variable name for API key
Model string `yaml:"model"` // Model name to use
Bare string `yaml:"bare,omitempty"` // CLI bare-mode selector: "auto" (default), "true", or "false"
MaxBudgetUSD float64 `yaml:"max_budget_usd,omitempty"` // Optional spend cap passed to the CLI provider via --max-budget-usd
}
LLMConfig holds LLM provider configuration for autoupdate
type MemoryMonitor ¶ added in v0.37.0
type MemoryMonitor struct {
Enabled bool
WarnPercent float64
CritPercent float64
CritSwapPercent float64
PSIFullCrit float64
Sustain time.Duration
}
MemoryMonitor holds the memory thresholds, in percent of total memory or swap; PSIFullCrit is the "full avg60" pressure percentage.
type MemoryMonitorConfig ¶ added in v0.37.0
type MemoryMonitorConfig struct {
Enabled yaml.Node `yaml:"enabled,omitempty"`
WarnPercent yaml.Node `yaml:"warn_percent,omitempty"`
CritPercent yaml.Node `yaml:"crit_percent,omitempty"`
CritSwapPercent yaml.Node `yaml:"crit_swap_percent,omitempty"`
PSIFullCrit yaml.Node `yaml:"psi_full_crit,omitempty"`
Sustain yaml.Node `yaml:"sustain,omitempty"`
}
MemoryMonitorConfig is the raw `tray.monitors.memory:` block.
type Monitors ¶ added in v0.37.0
type Monitors struct {
SampleInterval time.Duration
Reminder time.Duration
Disk DiskMonitor
Memory MemoryMonitor
CPU CPUMonitor
Network NetworkMonitor
Emerge EmergeMonitor
Units UnitsMonitor
Readonly ReadonlyMonitor
Smart SmartMonitor
Updates UpdatesMonitor
GLSA GLSAMonitor
Sync SyncMonitor
}
Monitors is the resolved tray.monitors block: every value parsed, checked against its limits and defaulted.
type MonitorsConfig ¶ added in v0.37.0
type MonitorsConfig struct {
SampleInterval yaml.Node `yaml:"sample_interval,omitempty"`
Reminder yaml.Node `yaml:"reminder,omitempty"`
Disk yaml.Node `yaml:"disk,omitempty"`
Memory yaml.Node `yaml:"memory,omitempty"`
CPU yaml.Node `yaml:"cpu,omitempty"`
Network yaml.Node `yaml:"network,omitempty"`
Emerge yaml.Node `yaml:"emerge,omitempty"`
Units yaml.Node `yaml:"units,omitempty"`
Readonly yaml.Node `yaml:"readonly,omitempty"`
Smart yaml.Node `yaml:"smart,omitempty"`
Updates yaml.Node `yaml:"updates,omitempty"`
GLSA yaml.Node `yaml:"glsa,omitempty"`
Sync yaml.Node `yaml:"sync,omitempty"`
}
MonitorsConfig is the decoded `tray.monitors:` section. Every leaf and every block is a yaml.Node, so an absent key stays distinct from a zero and a value of the wrong YAML type ("10%", "maybe") or a block of the wrong shape (`disk: 5`) reaches GetMonitors as a warning instead of failing the whole config load. Each block decodes into its own *MonitorConfig type.
type NetworkMonitor ¶ added in v0.37.0
type NetworkMonitor struct {
Enabled bool
DownAfter time.Duration
DownAfterStartup time.Duration
BackAfter time.Duration
}
NetworkMonitor holds the network debounce windows.
type NetworkMonitorConfig ¶ added in v0.37.0
type NetworkMonitorConfig struct {
Enabled yaml.Node `yaml:"enabled,omitempty"`
DownAfter yaml.Node `yaml:"down_after,omitempty"`
DownAfterStartup yaml.Node `yaml:"down_after_startup,omitempty"`
BackAfter yaml.Node `yaml:"back_after,omitempty"`
}
NetworkMonitorConfig is the raw `tray.monitors.network:` block.
type NoticeConfig ¶
type NoticeConfig struct {
// SitePath is the site repository's root; the notice YAML goes under
// <site_path>/src/content/notices/. Empty means "print the YAML instead".
// A leading `~/` is expanded by GetNoticeSitePath.
SitePath string `yaml:"site_path,omitempty"`
}
NoticeConfig is the `notice:` block: where `bentoo notice` writes the site half of a notice.
type OverlayConfig ¶
OverlayConfig holds overlay-specific settings
type OverlayValidationError ¶
OverlayValidationError represents an overlay validation failure
func (*OverlayValidationError) Error ¶
func (e *OverlayValidationError) Error() string
type OverlayValidationResult ¶
type OverlayValidationResult struct {
Valid bool // True if overlay structure is valid
Errors []string // Critical issues that prevent operation
Warnings []string // Non-critical issues
}
OverlayValidationResult contains overlay validation results
func ValidateOverlayStructure ¶
func ValidateOverlayStructure(path string) *OverlayValidationResult
ValidateOverlayStructure checks if a path is a valid Gentoo overlay. A valid overlay must have: - profiles/ directory - metadata/ directory
type ReadonlyMonitor ¶ added in v0.37.0
type ReadonlyMonitor struct {
Enabled bool
}
ReadonlyMonitor switches the read-only remount monitor.
type ReadonlyMonitorConfig ¶ added in v0.37.0
ReadonlyMonitorConfig is the raw `tray.monitors.readonly:` block.
type RepoConfig ¶
type RepoConfig struct {
Provider string `yaml:"provider"` // "github", "gitlab", "git", or "local"
URL string `yaml:"url"` // Full URL or org/repo for GitHub/GitLab/git (remote)
Path string `yaml:"path"` // On-disk tree for provider "local" (read in place, no clone)
Branch string `yaml:"branch"` // Branch to use (default: master/main)
}
RepoConfig holds configuration for a custom repository.
A per-repository auth token is no longer a field here: it now resolves from BENTOO_REPO_<NAME>_TOKEN via the secrets chain (see internal/common/secrets and cmd/bentoo's repoTokenName). A legacy `token:` key left in config.yaml is surfaced by the migration diagnostic in LoadFrom and otherwise ignored.
type ReviewConfig ¶
type ReviewConfig struct {
// Timeout bounds one review invocation, in SECONDS — the same unit and
// shape as cache_ttl, http_timeout and autoupdate.validate.timeout, because
// YAML has no duration literal and an int of seconds is what this file
// already speaks. Unset, zero or negative means the default: a budget of
// zero seconds would kill every review the instant it started, which is
// the failure this key exists to bound and not a way to configure it.
Timeout int `yaml:"timeout,omitempty"`
}
ReviewConfig is the `autoupdate.review` block: the budget one `overlay compare` divergence review runs under.
It is not autoupdate.validate.review, the tri-state bool deciding WHETHER staged-bump validation asks a model at all; this block decides HOW LONG one review may take before it is cut off. Neither reads the other.
It is not a top-level `compare:` block because probeConfig lists Config's top-level keys by hand, and a block missing there makes every command print "field <key> not found in type config.probeConfig" on stderr; probeConfig reuses AutoupdateConfig verbatim, so a nested key inherits the mirror. It is not under autoupdate.llm because the compare path deliberately ignores that block (cmd/bentoo's reviewLLMConfig), so a budget there would go unread.
The default comes from a getter, never a struct literal, so an absent block, a half-written block and a nil pointer all resolve to:
timeout DefaultReviewTimeout (seconds)
func (*ReviewConfig) GetTimeout ¶
func (c *ReviewConfig) GetTimeout() time.Duration
GetTimeout returns the review budget as a duration, defaulting to DefaultReviewTimeout when unset or non-positive. The stored key is an int of seconds and the duration is what the caller needs; this getter is the one place the conversion happens.
A nil receiver answers the default exactly as an absent block does: the config is threaded through call sites that predate this block, and a getter that panicked there would turn an unwritten key into a crash.
type SearchConfig ¶
type SearchConfig struct {
Provider string `yaml:"provider"` // Search provider name (e.g., "perplexity")
APIKeyEnv string `yaml:"api_key_env"` // Environment variable name for API key
}
SearchConfig holds search provider configuration for autoupdate
type SmartMonitor ¶ added in v0.37.0
type SmartMonitor struct {
Enabled bool
}
SmartMonitor switches the udisks2 disk health monitor.
type SmartMonitorConfig ¶ added in v0.37.0
SmartMonitorConfig is the raw `tray.monitors.smart:` block.
type SyncMonitor ¶ added in v0.37.0
SyncMonitor holds how old a repository's last sync may grow before it is reported; MaxAge is never below MinSyncMaxAge.
type SyncMonitorConfig ¶ added in v0.37.0
type SyncMonitorConfig struct {
Enabled yaml.Node `yaml:"enabled,omitempty"`
MaxAge yaml.Node `yaml:"max_age,omitempty"`
}
SyncMonitorConfig is the raw `tray.monitors.sync:` block.
type TrayConfig ¶
type TrayConfig struct {
// Interval is a time.ParseDuration string; empty means DefaultTrayInterval.
Interval string `yaml:"interval,omitempty"`
// FeedURL is the notices feed; empty means DefaultTrayFeedURL.
FeedURL string `yaml:"feed_url,omitempty"`
// Mute lists notice types that are recorded unread but never notified.
Mute []string `yaml:"mute,omitempty"`
// DowngradeCritical sends critical notices at normal urgency.
DowngradeCritical bool `yaml:"downgrade_critical,omitempty"`
// SkipMetered is a pointer so an explicit false stays distinct from an
// absent key, whose default is true.
SkipMetered *bool `yaml:"skip_metered,omitempty"`
// Monitors is the raw system health section, kept as a node so a section
// of the wrong shape reaches GetMonitors as a warning instead of failing
// the whole config load. GetMonitors decodes it into MonitorsConfig.
Monitors yaml.Node `yaml:"monitors,omitempty"`
}
TrayConfig is the `tray:` block read by bentoo-tray. The getters apply the defaults and return their warnings as strings: this package does not log, the caller does.
func (TrayConfig) GetFeedURL ¶
func (t TrayConfig) GetFeedURL() string
GetFeedURL returns the configured feed URL or DefaultTrayFeedURL.
func (TrayConfig) GetInterval ¶
func (t TrayConfig) GetInterval() (time.Duration, []string)
GetInterval returns the check interval: DefaultTrayInterval when unset or unparsable, and never below MinTrayInterval. Each correction comes back as a warning naming the configured value.
func (TrayConfig) GetMonitors ¶ added in v0.37.0
func (t TrayConfig) GetMonitors() (Monitors, []string)
GetMonitors resolves tray.monitors. An absent key takes its default; an unparsable or out-of-range value takes its default too and comes back as one warning naming the full key and the configured value. A section or block that is not a mapping warns the same way and takes the defaults of everything inside it; a null one is absent.
func (TrayConfig) GetMute ¶
func (t TrayConfig) GetMute() (types []string, warnings []string)
GetMute returns the mutable notice types listed in tray.mute, in their configured order. "security" and unknown types (matched case-sensitively) are dropped, one warning each.
func (TrayConfig) GetSkipMetered ¶
func (t TrayConfig) GetSkipMetered() bool
GetSkipMetered reports whether checks are skipped on a metered connection; true unless tray.skip_metered is explicitly false.
type UIConfig ¶
type UIConfig struct {
// Mode is the renderer to use: auto, plain, inline or fullscreen — the
// same four words the --ui flag and the BENTOO_UI environment variable
// accept, so a value that works in one works in the others.
//
// It is neither validated nor defaulted here, by design:
// - No validation: internal/common/report.ResolveMode owns the legal set
// and names it in its rejection message; a second list here would
// drift. The value is stored verbatim, and this package does not
// depend on report.
// - No default: the empty string means the operator said nothing, which
// must stay distinguishable from an explicit `mode: auto` so an
// unconfigured run behaves exactly as before this key existed.
Mode string `yaml:"mode,omitempty"`
}
UIConfig is the `ui:` block: how a long-running command renders itself.
type UnitsMonitor ¶ added in v0.37.0
UnitsMonitor selects the systemd managers whose failed units are announced.
type UnitsMonitorConfig ¶ added in v0.37.0
type UnitsMonitorConfig struct {
Enabled yaml.Node `yaml:"enabled,omitempty"`
System yaml.Node `yaml:"system,omitempty"`
User yaml.Node `yaml:"user,omitempty"`
}
UnitsMonitorConfig is the raw `tray.monitors.units:` block.
type UpdatesMonitor ¶ added in v0.37.0
type UpdatesMonitor struct {
Enabled bool
}
UpdatesMonitor switches the pending world updates monitor.
type UpdatesMonitorConfig ¶ added in v0.37.0
UpdatesMonitorConfig is the raw `tray.monitors.updates:` block.
type ValidateConfig ¶
type ValidateConfig struct {
// Depths is the per-class depth table, keyed by the bump classes
// internal/autoupdate/validate.Classify produces. A class left unset
// answers its documented default, never the empty string.
Depths ValidateDepths `yaml:"depths,omitempty"`
// RequireIsolation makes a compile gate SKIP rather than run unisolated,
// so a pass never claims a fidelity it did not have. It defaults to false
// because `unshare --net` is denied on ordinary hosts, and a default of
// true would turn every build gate into a SKIPPED (the --require-isolation
// default, unchanged now that it has a key).
RequireIsolation bool `yaml:"require_isolation,omitempty"`
// RequireProof refuses to publish a bump whose validation could not reach
// the depth policy asked for. It defaults to false: an ordinary
// workstation rarely holds every build dependency, so a default of true
// would refuse most bumps for a reason that says nothing about them.
// The unreached depth is reported either way.
RequireProof bool `yaml:"require_proof,omitempty"`
// Review and FixOnFailure are the two LLM capabilities, and they are
// TRI-STATE on purpose. The capabilities are enabled by --llm; this
// configuration can only SUBTRACT from that flag, never add to it.
// A plain bool cannot express "leave it to the flag" and
// "switch this one back off" as different things, so an unset key stays
// nil and only an explicit `review: false` disables. GetReview reports the
// configured value alone (false unless the file says true); the flag layer
// combines the two through ReviewDisabled.
Review *bool `yaml:"review,omitempty"`
// FixOnFailure is the build fixer, tri-state for the same reason as
// Review above.
FixOnFailure *bool `yaml:"fix_on_failure,omitempty"`
// Timeout bounds a single agent run, in SECONDS — the same unit and shape
// as cache_ttl and http_timeout above, because YAML has no duration
// literal and an int of seconds is what this file already speaks. It is
// read by the reviewer and by the build fixer: an agent with no deadline
// hangs an unattended sweep. Unset or non-positive means the default.
Timeout int `yaml:"timeout,omitempty"`
// Packages holds per-package overrides, keyed by category/name. An
// override supplies the depth to use and the reason it is used; an
// override with no reason is reported invalid, naming the package,
// because an override is the one input that can quietly reduce how much a
// bump is checked.
//
// The packages nobody wants to build from source ship AS ORDINARY ENTRIES
// in this map (see DefaultPackageOverrides), not as a hardcoded tier list,
// so the reason rules reach them exactly as they reach anything an
// operator writes — and so the report that says why a bump was not
// validated can quote their reason like any other.
Packages map[string]ValidatePackageOverride `yaml:"packages,omitempty"`
}
ValidateConfig is the staged-bump validation policy: how much of a bump is checked before publishing, and on whose stated authority a package gets less.
It lives here, not in the overlay's packages.toml, where a key ahead of the installed binary silently disables its record; here a typo is a stderr line from the strict re-decode in LoadFrom and the run continues.
Every default comes from a getter, never a struct literal, so an absent block, a half-written block and a nil pointer all resolve to:
depths.revision options depths.series configure depths.patch options depths.major configure require_isolation false require_proof false review false fix_on_failure false timeout 3600 (seconds)
`compile` is never a default (only --depth/--compile or a reasoned override): validating everything at compile depth does not become expensive, it becomes ignored.
func (*ValidateConfig) FixOnFailureDisabled ¶
func (c *ValidateConfig) FixOnFailureDisabled() bool
FixOnFailureDisabled reports an explicit `fix_on_failure: false`. See ReviewDisabled.
func (*ValidateConfig) GetDepthForClass ¶
func (c *ValidateConfig) GetDepthForClass(class string) string
GetDepthForClass returns the configured depth for a bump class, falling back to that class's documented default.
It NEVER returns the empty string, for any input: the resolver downstream always has a depth to work with, and an unrecognized class is answered as the riskiest known one (major) rather than as "no validation", because failing to classify a bump is not evidence that the bump is small.
The class name is matched case-insensitively and trimmed — it is a lookup key this package chooses, not a value it reports. The configured VALUE is returned verbatim, so a typo in a depth name reaches validate.ParseDepth and is rejected there by name instead of being silently repaired here.
func (*ValidateConfig) GetFixOnFailure ¶
func (c *ValidateConfig) GetFixOnFailure() bool
GetFixOnFailure reports the CONFIGURED value of the build-fixer capability. See GetReview for why this is not the effective value.
func (*ValidateConfig) GetRequireIsolation ¶
func (c *ValidateConfig) GetRequireIsolation() bool
GetRequireIsolation reports whether a compile gate must SKIP rather than run unisolated. False by default, and false through a nil receiver: this is the --require-isolation default, unchanged now that it also has a key.
func (*ValidateConfig) GetRequireProof ¶
func (c *ValidateConfig) GetRequireProof() bool
GetRequireProof reports whether a bump whose validation could not reach the policy depth must be refused rather than published with the unreached depth named. False by default.
func (*ValidateConfig) GetReview ¶
func (c *ValidateConfig) GetReview() bool
GetReview reports the CONFIGURED value of the reviewer capability, which is false unless the file says otherwise. It is not the effective value: the capabilities are switched on by --llm and configuration only subtracts, so the flag layer combines this with ReviewDisabled.
func (*ValidateConfig) GetTimeout ¶
func (c *ValidateConfig) GetTimeout() time.Duration
GetTimeout returns the per-agent budget as a duration, defaulting to DefaultValidateTimeout when unset or non-positive. The stored key is an int of seconds; the duration is what the callers (the reviewer and the build fixer) actually need.
func (*ValidateConfig) OverrideErrors ¶
func (c *ValidateConfig) OverrideErrors() []error
OverrideErrors reports every per-package override that is invalid, one error per package, in a stable (sorted) order so a diagnostic does not reshuffle between runs.
The rule enforced here: an override must state its reason. It is reported, never fatal — the same treatment an unknown key gets — so one bad entry cannot cost the operator the rest of the file.
The depth STRING is deliberately not validated here. validate.ParseDepth owns that vocabulary and rejects an unknown rung by name; duplicating the ladder in this package would put the same list in two places, and the copy would be the one that goes stale.
func (*ValidateConfig) ReviewDisabled ¶
func (c *ValidateConfig) ReviewDisabled() bool
ReviewDisabled reports an explicit `review: false`, which is the only way a config file can switch the reviewer back off for a run started with --llm.
type ValidateDepths ¶
type ValidateDepths struct {
Revision string `yaml:"revision,omitempty"`
Patch string `yaml:"patch,omitempty"`
Series string `yaml:"series,omitempty"`
Major string `yaml:"major,omitempty"`
}
ValidateDepths is the per-class depth table under `autoupdate.validate.depths`.
Each value is a rung spelled exactly as internal/autoupdate/validate.ParseDepth accepts it: none, options, patches, configure, compile, install — shallowest first, each including every rung before it. This package does not validate them; ParseDepth is the validator, and the import runs the other way.
It is a struct and not a map[string]string so that a mistyped CLASS name ("revison:") is caught by the strict re-decode in LoadFrom and reported on stderr. A map would accept the typo silently and the class it was meant for would quietly keep its default — which is the packages.toml failure mode this block exists to avoid.
type ValidatePackageOverride ¶
type ValidatePackageOverride struct {
// Depth is a rung of the validation ladder, spelled exactly as
// internal/autoupdate/validate.ParseDepth accepts it: none, options,
// patches, configure, compile, install. It is stored and reported verbatim
// — this package deliberately neither trims nor case-folds it, because
// ParseDepth does not either, and a config layer that silently repaired
// " Compile " would make the name in the file and the name in the report two
// different strings.
Depth string `yaml:"depth"`
// Reason is why this package departs from its class depth. It is required:
// see OverrideErrors.
Reason string `yaml:"reason"`
}
ValidatePackageOverride is one entry of autoupdate.validate.packages: the depth to use for this package and the reason for using it.
Both fields are reported beside the outcome, so a bump validated at a shallower depth than its class calls for can always say on whose authority.
type VendorConfig ¶ added in v0.36.0
type VendorConfig struct {
// Hosts lists the distfile hosts whose vendor tarballs the applier owns.
// A configured list replaces the default rather than extending it, so the
// default host can be taken out.
Hosts []string `yaml:"hosts,omitempty"`
// UploadCommand is the argv that publishes a generated tarball, run without
// a shell. {path} is replaced by the tarball's absolute path and {file} by
// its file name; no other placeholder exists. Unset means never upload.
UploadCommand []string `yaml:"upload_command,omitempty"`
}
VendorConfig is the autoupdate.vendor block.
func (VendorConfig) EffectiveHosts ¶ added in v0.36.0
func (v VendorConfig) EffectiveHosts() []string
EffectiveHosts returns the configured hosts lower-cased, or the default host when none is configured.
func (VendorConfig) Validate ¶ added in v0.36.0
func (v VendorConfig) Validate() error
Validate refuses an upload command whose first element is empty or whose elements carry a placeholder other than {path} and {file}. The error names the key and the offending element's index.