Add a local YAML config file for persistent settings

Reads $XDG_CONFIG_HOME/slocker-lite/config.yaml (falling back to
$HOME/.config/slocker-lite/config.yaml), organized into sections. Only
the "global" section's log-level is supported for now -- other options
are one-shot flags, not standing preferences. An explicit --log-level
on the command line always overrides the config file, the same way
SPDLOG_LEVEL already does.

Uses libyaml directly (yaml_dep was already declared in meson.build but
unused). A missing config file isn't an error; unknown sections/keys
are ignored for forward-compatibility; malformed YAML syntax is a hard
error.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gv3s5jckJKzh6JkMoi2Akz
This commit is contained in:
2026-08-21 12:31:40 +00:00
parent f7e7faed19
commit be5a0b8202
6 changed files with 173 additions and 1 deletions
+17
View File
@@ -94,6 +94,23 @@ sudo ./buildDir/slocker-lite -r myimage.tar --user git
./buildDir/slocker-lite -l ./images
```
## Configuration
Persistent settings can be kept in a local YAML config file at
`$XDG_CONFIG_HOME/slocker-lite/config.yaml` (falling back to
`$HOME/.config/slocker-lite/config.yaml` if `XDG_CONFIG_HOME` isn't set). The file is
organized into sections; only `global` exists today:
```yaml
global:
log-level: debug
```
Only options that make sense as a standing preference are supported here — right now
just `log-level` (one-shot commands like `--mount`/`--run`/`--user` don't belong in a
config file). A missing config file is fine (nothing is overridden); an explicit
`--log-level` on the command line always overrides the config file.
## How it works
Image layers are imported into `containers-storage` (parent-chained) and the