Commit 17f6a70
feat(config): honor MEMPALACE_CONFIG_DIR, mirroring the palace-path override
`MempalaceConfig.__init__` took `config_dir` as a constructor argument documented "useful for
testing", with no environment or CLI lever — so the config directory hardwires to `~/.mempalace` for
every spawned process, while `palace_path` already honors `MEMPALACE_PALACE_PATH`.
A host that embeds mempalace as a sidecar spawns it as a process: it can pass env and argv, and
nothing else. The config file supplies `backend`, `collection_name`, `embedding_model`,
`write_routing`, `palace_path`, the milvus/qdrant/pgvector sets and ~20 more, so an embedding host
inherits every one of them from a user-level file it does not own. Countering key-by-key with env
vars does not scale to that surface; one symmetric lever closes it.
Resolution order matches `palace_path`: explicit argument > environment > default. `~` expands, a
blank value reads as unset, and an unset variable leaves `~/.mempalace` exactly where it stood — the
change adds a lever and moves no existing behaviour.
Six tests cover the promised order: env redirects both config-dir-derived files; a config.json under
the env-named directory actually feeds resolved values; an explicit argument outranks the env; unset
and blank both keep the home default; `~` expands.
Revert-verified: with the change reverted, 3 of the 6 fail — the guard bites rather than passing
vacuously.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q4NJGuNb4oxv4C8RJH8TJx1 parent 72bbb0a commit 17f6a70
2 files changed
Lines changed: 81 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
357 | | - | |
358 | | - | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
359 | 360 | | |
360 | 361 | | |
361 | 362 | | |
362 | 363 | | |
363 | | - | |
364 | | - | |
365 | | - | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
366 | 379 | | |
367 | 380 | | |
368 | 381 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
0 commit comments