ContainerDeskDocs
Start hereView source ↗

🧭 Local settings

The native app resolves Tauri’s platform application-data directory and owns its preferences/ child. Linux normally uses $XDG_DATA_HOME/dev.containerdesk.app/preferences (or ~/.local/share/...); macOS uses its native application-data path. Paths come from Tauri, not renderer input. Tests inject a separate adapter or temporary directory.

Schema 3 contains only theme, revision, selected host ID, saved aliases/IDs, display names, groups, labels, per-host read-only preference and favorite flag, saved SSH selection/config policy and Docker executable/context/sudo options, trusted SSH config path and executable override references. It contains no key contents, passphrases, raw inspect JSON, logs or terminal output. Unknown fields are rejected. Hosts are limited to 1,000; aliases/names 256 bytes, groups/labels 128, 32 labels per host, absolute path references 4,096; serialized storage is at most 1 MiB. Config/executable references are stored but not opened/executed by the store. Native local SSH executable validation is enforced separately; a saved remote Docker path is validated as syntax only. Read-only preferences never replace later backend operation policy or user action confirmation.

The app-owned directory is 0700, files 0600. Existing files must be regular, owned by the effective user and not hard-linked. Final path symlinks are refused. A nonblocking exclusive file lock prevents concurrent app instances from overwriting settings. Data is written to an exclusively created private temporary file, fsynced, renamed and the directory fsynced. Before replacing settings.json, settings.previous.json receives the last validated bytes by the same procedure. Locks release on process exit. The adapter cleans only its exact failed temporary write; orphan files from a crash are ignored, not broadly deleted.

Schema 1 has the same non-secret fields without revision. Migration adds revision and current schema 3, while retaining exact original bytes as the previous version. Schema 2 migrates with stable HostIds, favorite=false, no per-host SSH selection (legacy global reference) and default Docker options. Schema 1 is a migration fixture/contract; there was no earlier shipped settings store. Future schema versions are left untouched, shown with a visible notice and made read-only. A stale revision is rejected instead of overwriting newer settings.

Corrupt primary JSON is copied to an exclusive settings.corrupt-N.json archive before replacement. A validated previous version is recovered; otherwise defaults are used with a visible reset notice. Up to 16 damaged originals are retained. If preserving the original fails or limits/permissions prevent safe access, loading fails visibly and saving stays disabled. An oversized file is retained without reading beyond the byte limit. If commit outcome is uncertain (for example, directory fsync fails after rename), further saves are disabled until restart. The UI retains the last confirmed theme, shows a safe message and never retries a failed save automatically.

get_preferences and set_theme serve preferences; mode-scoped inventory/save/remove/connect/disconnect commands serve the host editor. Connection snapshots are transient. In native mode the existing theme controls load and save preferences; browser preview remains in-memory. Recovery/migration notices are visible on all routes for the current run. No host is connected by startup or preference loading.

Verification: original 005 evidence, later native Mac tests and package paths in 054, and real-file schema migration/rollback in 056. Native file tests pass on Linux and both Mac architectures; real Finder startup creates the private Mac preference directory. Unit fault injection models an interrupted commit, not physical power-loss certification. Keep a separate pre-upgrade copy as described in manual updates; the rolling previous file is not a permanent downgrade backup.