Documentation
¶
Overview ¶
Package config loads the settings `patchcord serve` runs with from three layered sources — a YAML file, environment variables, and CLI flags — in that increasing order of precedence: a flag explicitly passed always wins, then an environment variable, then the config file, then a built-in default (ADR-0038). It only holds the settings themselves; the CLI (internal/cli/serve.go) owns the built-in defaults and the flag layer, since only it knows which flags were actually passed (cobra's Flags().Changed).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultDataDir ¶
func DefaultDataDir() string
DefaultDataDir resolves the built-in default for --data-dir / PATCHCORD_DATA_DIR (ADR-0038, ADR-0049): the lowest-precedence source, used only when neither a flag nor the environment variable is set. Unlike the "./data" it replaces, this is a per-user, per-machine location that does not depend on the directory a command happens to be run from — every patchcord command run by the same user resolves the same agent database by default (ADR-0052).
It follows each OS's own convention for per-user application data:
- macOS: ~/Library/Application Support/patchcord
- Linux/BSD: $XDG_DATA_HOME/patchcord, or ~/.local/share/patchcord if unset
- Windows: %LOCALAPPDATA%\patchcord
Types ¶
type Config ¶
type Config struct {
Listen string `yaml:"listen"`
DataDir string `yaml:"data_dir"`
// SecretsMasterKeyFile points to the file holding the base64 AES-256
// master key for the "file" secret store (secrets.FileStore). Left
// empty, the "file" secret reference type is simply not available on
// this agent — see ADR-0040.
SecretsMasterKeyFile string `yaml:"secrets_master_key_file"`
}
Config holds the subset of runtime.Config that can come from a file or environment variables, not just CLI flags. An empty field means that source expressed no opinion — see Merge.
func FromEnv ¶
func FromEnv() Config
FromEnv reads PATCHCORD_LISTEN, PATCHCORD_DATA_DIR and PATCHCORD_SECRETS_MASTER_KEY_FILE. An unset variable leaves the corresponding field empty, so Merge falls through to a lower-precedence source for it.
func Load ¶
Load reads and parses a YAML config file. Unknown top-level keys are rejected (a typo'd "liste:" is caught here, not silently ignored) — the same discipline internal/workflow.Validate already applies to workflow YAML.