Config Command¶
The config command provides programmatic read/write access to individual configuration values.
Its primary audience is CI pipelines and tool authors automating setup — not humans doing
interactive reconfiguration (use init <subsystem> for that instead).
For the catalogue of keys the framework reads (types, defaults, env mapping), see the Configuration Keys reference.
Usage¶
mytool config get <key> [--output text|json|yaml] [--unmask]
mytool config set <key> <value>
mytool config unset <key>
mytool config list [--output text|json|yaml]
mytool config path [--writable] [--output text|json|yaml]
mytool config edit [--editor <cmd>]
mytool config validate
File-layer-only operations
set, unset, and edit mutate only the writable config file — the
layer path reports as writable. Values resolved from environment
variables or CLI flags are not file-backed and cannot be unset or edited;
unset refuses with not found for a key that is present only via those
layers. The result of every write is re-validated against the same schema
as config validate, so these commands can never leave a config the
validator would reject.
Feature Flag¶
The config command is disabled by default. Enable it via props.SetFeatures:
When to enable
Enable ConfigCmd for developer-facing CLI tools where local YAML config management
is relevant. For containerized services, leave it disabled — configuration arrives via
environment variables or mounted secrets, not YAML files.
Subcommands¶
config get <key>¶
Read a single configuration value and emit it to stdout for shell script consumption.
Sensitive values (tokens, passwords, secrets) are masked by default. Use --unmask to
reveal the raw value.
# Plain text output
mytool config get log.level
# JSON output (useful in CI for structured parsing)
mytool config get github.auth.token --output json
# Reveal masked value
mytool config get github.auth.token --unmask
Flags:
| Flag | Description | Default |
|---|---|---|
--output |
Output format: text, json, yaml |
text |
--unmask |
Disable sensitive value masking | false |
config set <key> <value>¶
Write a single configuration value. The value is type-coerced (bool → int64 → string) and persisted to the config file on disk.
config unset <key>¶
Remove a single configuration value — the inverse of config set. Only the writable
file layer is affected. The post-removal config is re-validated before it is written:
removing a required key (e.g. log.level) is refused and leaves the file untouched.
A key that exists only via an environment variable or flag is reported as not found,
because there is nothing in the file for unset to remove.
config path¶
Print the config file(s) that contributed to the live configuration. Because configuration
is merged across a precedence chain, several files can contribute; by default path lists
each contributing file in merge order plus the writable target that set/unset/edit
mutate.
# All contributing files plus the writable target
mytool config path
# Only the writable target — handy in scripts
mytool config path --writable
# Structured output
mytool config path --output json
When no config file is currently loaded, path prints only the writable target (the path a
future set would create) and notes that no file is loaded — it does not error.
Flags:
| Flag | Description | Default |
|---|---|---|
--writable |
Print only the single writable target path | false |
--output |
Output format: text, json, yaml |
text |
config edit¶
Open the writable config file in your editor, re-validate it on save, and persist the change
only if it is valid. The editor is resolved from --editor, then $VISUAL, then $EDITOR,
then a platform default (vi on Unix, notepad on Windows). Editor commands are parsed with
shell-quoting awareness, so both EDITOR="code --wait" and quoted paths containing spaces work.
edit requires an interactive terminal; in CI or a non-interactive pipeline it refuses and
points you at set/unset. On a non-zero editor exit the original file is left untouched. On
invalid YAML or a schema validation failure the edit is aborted and your unsaved work is
preserved at a reported temp-file path so nothing is lost.
config list¶
List all resolved configuration values, sorted alphabetically. Sensitive values are masked.
# Human-readable table
mytool config list
# Machine-readable JSON (for CI inspection)
mytool config list --output json
config validate¶
Validate the current configuration against the tool's required schema. Exits non-zero if any required fields are missing or invalid.