Configuration#
Cairn can be configured via an optional JSON config file, environment variables, and CLI flags.
Precedence (highest to lowest)#
- Environment variables — always win
- CLI flags (e.g.
--db) - Config file (
cairn.json) - Defaults (OS-appropriate paths)
Config File#
Create a cairn.json file in your OS config directory:
| OS | Path |
|---|---|
| Linux | $XDG_CONFIG_HOME/cairn/cairn.json (default: ~/.config/cairn/cairn.json) |
| macOS | ~/Library/Application Support/cairn/cairn.json |
| Windows | %APPDATA%\cairn\cairn.json |
All keys are optional. Example:
{
"db_path": "/path/to/bookmarks.db",
"dropbox_app_key": "your-app-key",
"disable_auto_archive": false,
"desktop_hotkey": "CmdOrCtrl+Shift+Space"
}Supported Settings#
| JSON key | Environment variable | CLI flag | Description |
|---|---|---|---|
db_path | CAIRN_DB_PATH | --db | Path to the SQLite bookmark database |
dropbox_app_key | CAIRN_DROPBOX_APP_KEY | — | Dropbox app key for sync |
disable_auto_archive | CAIRN_DISABLE_AUTO_ARCHIVE | — | Set to true to stop auto-archiving stale bookmarks (default false) |
desktop_hotkey | CAIRN_DESKTOP_HOTKEY | — | Desktop app global shortcut that brings the window forward (default CmdOrCtrl+Shift+Space; off disables it) |
Disable Auto-Archiving#
**Turn off automatic archiving.** Set `disable_auto_archive` to `true` in `cairn.json` (or export `CAIRN_DISABLE_AUTO_ARCHIVE=true`) to keep every bookmark in your main list indefinitely — Cairn will skip the 30-day archive sweep on startup.
By default, Cairn keeps your active list tidy: on every TUI startup it
auto-archives any bookmark that isn’t pinned, is older than 30 days, and has
been on this device for at least 30 days (so bookmarks that arrive through
sync get 30 days locally, whatever their original date). Archived
bookmarks are never deleted — you can review and restore
them from the archive view (press a in the TUI).
If you’d rather keep every bookmark in the main list indefinitely, disable auto-archiving.
Via the config file — add to cairn.json:
{
"disable_auto_archive": true
}Via an environment variable:
export CAIRN_DISABLE_AUTO_ARCHIVE=trueWith this enabled, Cairn skips the archive check on startup and no bookmarks are
moved to the archive. Bookmarks already in the archive stay there until you
restore them; disabling auto-archiving does not un-archive anything, and you can
still restore them manually. Pinning individual bookmarks (p in the TUI, or
cairn pin <id>) remains an option if you only want to protect a few rather
than turning the feature off entirely.
Verify the setting took effect with cairn config (see below); it prints
CAIRN_DISABLE_AUTO_ARCHIVE=true when enabled.
Inspect Resolved Config#
cairn configPrints the effective values that Cairn will use, after applying all precedence rules.
Database Location#
If db_path is not set, Cairn uses a platform-appropriate default:
| OS | Default path |
|---|---|
| Linux | $XDG_DATA_HOME/cairn/bookmarks.db (default: ~/.local/share/cairn/bookmarks.db) |
| macOS | ~/Library/Application Support/cairn/bookmarks.db |
| Windows | %APPDATA%\cairn\bookmarks.db |
The database is created automatically on first run if it does not exist.
Security Notes#
- Store
dropbox_app_keyincairn.json, not in environment variables — env vars are visible in process listings (ps aux) and shell history - Ensure
cairn.jsonhas owner-only read permissions:chmod 600 ~/.config/cairn/cairn.json - Never commit
cairn.jsonorsync.jsonto version control
See Security for full guidance.