type: operations title: Configuration and data files description: How src/config.rs loads config.toml, the supported keys and defaults, where the data directory and databases live, and operational and security caveats. tags: [configuration, toml, data-directory, sqlite, security] verified:
ea70eb6c04
resource: repo://.gitignore2a737474d8
resource: repo://src/config.rs
generated: { by: "claude-code", at: "2026-10-19T18:58:46.219Z" }
---All runtime settings come from one TOML file loaded by Config::load
(src/config.rs:188-192). No environment variable is ever read
(src/config.rs:1-13).
The data directory is fixed: <platform config dir>/wh, resolved with
dirs::config_dir() (src/config.rs:106-110). On Windows this is
%APPDATA%\wh. It cannot be changed from the config file. At startup
ensure_data_dir creates it if missing (src/config.rs:214-217).
| File | Purpose | Defined by |
|---|---|---|
config.toml |
Optional settings | CONFIG_FILE, src/config.rs:34 |
session.db |
WhatsApp session store used by whatsapp-rust (WhatsApp client) |
session_db_path, src/config.rs:223-225 |
history.db |
Local messages, chats, contacts and autoreply flags (History store) | history_db_path, src/config.rs:231-233 |
| Key | Purpose | Default when missing or blank |
|---|---|---|
openai_api_key |
Bearer token for the AI endpoint (trimmed) | none — the AI client cannot be built |
openai_base_url |
Base URL of the OpenAI-compatible endpoint (trimmed, trailing / removed) |
https://ollama.com/v1 |
openai_model |
Model for text replies (trimmed) | deepseek-v4.1-flash |
openai_vision_model |
Model for image replies (trimmed) | none — image understanding disabled |
system_prompt |
Persona/instructions for autoreplies, kept as written (not trimmed, multiline allowed) | none — AI not configured |
Mapping and defaults: src/config.rs:198-208, src/config.rs:23-25.
The binary embeds no prompt text: without system_prompt the AI is not
configured and the status line says so (see
Application state). Unknown keys are ignored.
src/config.rs:142-152).cannot read config file <path>.invalid config file <path> with the
cause invalid TOML syntax or value type at line L, column C; the error
never echoes file content (src/config.rs:127-136).openai_base_url consisting only of slashes is rejected with
openai_base_url in config.toml must not be empty or only slashes
(src/config.rs:174-181).Startup aborts with cannot load configuration on any of these errors
(Runtime).
Config's Debug shows *** or <unset>
(src/config.rs:80-100), and the raw FileConfig has no Debug impl at
all (src/config.rs:64-78). The AI client redacts it too.config.toml in the data directory, outside the repository.
.gitignore ignores a root-level /config.toml and .env
(.gitignore:4-6), as well as SQLite journal/WAL/SHM files; note that the
*.db pattern is commented out (.gitignore:7), so databases copied into
the repo would not be ignored.session.db holds the linked-device credentials: deleting it forces a new
QR pairing. history.db can be deleted to reset local history and
autoreply flags; it is recreated on start.src/config.rs:236+ covers defaults, full files, blank values, multiline
prompts, trimming, base URL normalisation and errors, Debug masking,
vision model, DB paths, unknown keys, BOM/CRLF, non-leaking parse errors,
missing, existing, invalid and unreadable files. See
Unit tests.