config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config loads and validates cliwrap YAML configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandEnv

func ExpandEnv(s string) (string, error)

ExpandEnv replaces ${VAR} and ${VAR:-default} occurrences in s. An unresolved ${VAR} without a default returns an error.

func ParseByteSize

func ParseByteSize(s string) (uint64, error)

ParseByteSize parses strings like "256MiB" or "1GB" into a byte count. Supported suffixes:

B, KB, MB, GB, TB        (powers of 1000)
KiB, MiB, GiB, TiB       (powers of 1024)

An unsuffixed integer is interpreted as bytes. Whitespace between the number and suffix is allowed.

Types

type Config

type Config struct {
	Version          string
	Runtime          RuntimeConfig
	SystemBudget     SystemBudgetConfig
	SandboxProviders []string
	Groups           []ProcessGroup
}

Config is the canonical in-memory representation of a loaded YAML file.

func Load

func Load(data []byte) (*Config, error)

Load parses raw YAML bytes.

func LoadFile

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

LoadFile reads and parses a YAML config at path.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks for duplicate IDs and required fields across all groups.

type ProcessGroup

type ProcessGroup struct {
	Name      string
	Processes []cliwrap.Spec
}

ProcessGroup is a named collection of process specs.

type RuntimeConfig

type RuntimeConfig struct {
	Dir       string
	Debug     string // off | info | verbose | trace
	AgentPath string
}

RuntimeConfig mirrors the "runtime" YAML block.

type SystemBudgetConfig

type SystemBudgetConfig struct {
	MaxMemoryPercent float64
	MinFreeMemory    uint64
	MaxLoadAvg       float64
}

SystemBudgetConfig mirrors the "system_budget" YAML block.

Jump to

Keyboard shortcuts

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