Documentation
¶
Overview ¶
Package config parses and validates the agent's entire startup surface.
Every knob is an environment variable read exactly once, at start, and immutable thereafter. This is the agent's core security property: its powers are fixed by the operator's startup configuration, never by a client. There is deliberately no API, file, or signal that can change any value here.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
StateDir string
ListenAddr string
PublicAddrs []string
PolicyMode policy.Mode
DockerHost string
LogLevel slog.Level
LogMaxAge time.Duration
LogMaxTotalMB int
AuditMaxAge time.Duration
AuditMaxRows int
RateStatusPerMin int
RatePairPerMin int
RateGuardedPerSec int
// SelfContainer is an operator-supplied name-or-ID override for the
// agent's own container, used when the agent cannot detect it
// automatically. A container name (container_name: / --name) is the form
// worth using: docker compose up -d recreates the container whenever the
// compose file changes and mints a new ID, so an ID copied out of docker
// ps is stale on the very next boot, while a name survives recreation.
// Empty is the normal case; it has no default.
SelfContainer string
}
Config is the fully parsed, validated startup configuration.
func Load ¶
Load reads the configuration from getenv, applies defaults, and validates.
getenv is a parameter rather than a direct call to os.Getenv so tests can supply a fake map without mutating process state — t.Setenv forbids t.Parallel, and this package's table test is the largest in the repository.
On failure it returns a *ValidationError listing every problem, never just the first, and a zero Config that callers must not use.
func (Config) AgentLogPath ¶
AgentLogPath is the current operational log file.
type ValidationError ¶
type ValidationError struct{ Problems []string }
ValidationError reports every problem found in one pass.
It aggregates rather than failing on the first fault: an operator correcting a `docker run` line one variable at a time, one restart at a time, is a bad first experience and the exact thing this package exists to avoid.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string