Skip to content

Commit 54fc206

Browse files
committed
docs: document secrets.env auto-loading, file attachments, and config priority
- Add secrets.env section to CONFIG.md (format, rules, example) - Add Layer 0 to priority chain diagram - Update Quick Examples to use secrets.env pattern - Add v0.34.0 changelog entry
1 parent 92b848d commit 54fc206

2 files changed

Lines changed: 61 additions & 6 deletions

File tree

docs/CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# Changelog
22

3+
## v0.34.0 (2026-05-23) — secrets.env Auto-Load + File Attachments
4+
5+
### Secrets Management
6+
- **`~/.odek/secrets.env` auto-loaded** as Layer 0 in the config priority chain — parsed before any config file or env var lookup
7+
- No more plaintext secrets in `config.json` — use `"api_key": "${ODEK_API_KEY}"` with the value in `secrets.env`
8+
- Supports `KEY=VALUE` lines, `#` comments, blank lines, and does NOT overwrite existing env vars
9+
- Missing/unreadable file is silently ignored
10+
11+
### Telegram File Attachments
12+
- **`sendMedia`** now falls back to `SendDocument` for unknown media types (zip, csv, pdf, etc.)
13+
- **System prompt** now explicitly instructs the agent about file attachment:
14+
- `send_message` tool with `file` parameter for intermediate replies
15+
- `MEDIA:document:/path` in final answers for native file delivery
16+
17+
### Domain Migration
18+
- All `kode.21no.de``odek.21no.de` references (defaultSystem, Quick Facts, RuntimeContext)
19+
20+
---
21+
322
## v0.33.2 (2026-05-23) — Narrator Integration Complete
423

524
### Telegram Engaging Mode

docs/CONFIG.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,20 @@
77
Each layer overrides the one below it. Unset fields inherit from the layer below:
88

99
```
10-
1. ~/.odek/config.json ← Global defaults (shared across projects)
11-
2. ./odek.json ← Project-specific overrides
12-
3. ODEK_* env vars ← Runtime/environment overrides
13-
4. CLI flags ← Explicit invocation (highest priority)
10+
0. ~/.odek/secrets.env ← Auto-loaded into process environment on startup
11+
1. ~/.odek/config.json ← Global defaults (shared across projects)
12+
2. ./odek.json ← Project-specific overrides
13+
3. ODEK_* env vars ← Runtime/environment overrides
14+
4. CLI flags ← Explicit invocation (highest priority)
1415
```
1516

17+
Layer 0 is unique: it does not hold config fields directly. Instead it injects
18+
`KEY=VALUE` pairs into the process environment so they're available for:
19+
20+
- **Layer 1–2** `${VAR}` substitution in config files
21+
- **Layer 3** `ODEK_*` env var lookups (e.g. `ODEK_API_KEY`)
22+
- **Legacy fallbacks** like `DEEPSEEK_API_KEY` / `OPENAI_API_KEY`
23+
1624
## Config files
1725

1826
### Global defaults (`~/.odek/config.json`)
@@ -48,6 +56,33 @@ Same schema as global. Only set the fields you want to override:
4856

4957
Both files are optional. Missing files are silently ignored. String values support `${VAR}` environment variable substitution — useful for API keys without plaintext storage.
5058

59+
## Secrets file (`~/.odek/secrets.env`)
60+
61+
Auto-loaded on every `odek` invocation before any config file or env var is read.
62+
Each `KEY=VALUE` line is injected into the process environment via `os.Setenv`.
63+
64+
```
65+
ODEK_API_KEY=sk-...
66+
GITHUB_TOKEN=ghp_...
67+
```
68+
69+
Rules:
70+
- **File format:** `KEY=VALUE` — one per line, no `export` keyword needed
71+
- **Blank lines and `#` comments** are skipped
72+
- **Existing env vars are NOT overwritten** — if `ODEK_API_KEY` is already in the environment, the file is ignored for that key
73+
- **Missing/unreadable file** is silently ignored (not an error)
74+
- **Permissions:** keep `0600` (`chmod 600 ~/.odek/secrets.env`)
75+
76+
This lets you keep secrets out of config files entirely:
77+
78+
```json
79+
// ~/.odek/config.json — no plaintext secrets
80+
{
81+
"model": "deepseek-v4-flash",
82+
"api_key": "${ODEK_API_KEY}" // ← resolved from secrets.env at runtime
83+
}
84+
```
85+
5186
## Environment variables
5287

5388
Every config knob has a `ODEK_*` counterpart:
@@ -241,8 +276,9 @@ odek init --force
241276
## Quick examples
242277

243278
```bash
244-
# Set API key via environment variable (recommended — keeps secrets out of config files)
245-
export ODEK_API_KEY="sk-..."
279+
# Set API key via secrets.env (recommended — keeps secrets out of config files)
280+
echo 'ODEK_API_KEY="sk-..."' >> ~/.odek/secrets.env
281+
chmod 600 ~/.odek/secrets.env
246282

247283
# Global config (model and other settings only, no secrets)
248284
echo '{"model": "deepseek-v4-flash"}' > ~/.odek/config.json

0 commit comments

Comments
 (0)