You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(config): derive env var names from dotted config paths (#725)
## Summary
- Make the dotted TOML config path the single source of truth for env
var names: `MICASA_` + `UPPER(key with "." → "_")`. Users can look at
any config key and immediately infer the env var.
- Remove all `env:"..."` struct tags; derive names at runtime via
`EnvVarName(key)`.
- Refactor `migrateRenamedEnvVars` as a table-driven function returning
an overrides map instead of mutating config fields directly. Handles
multi-generation chains (e.g. `MICASA_MAX_OCR_PAGES` →
`MICASA_MAX_EXTRACT_PAGES` → `MICASA_EXTRACTION_MAX_PAGES`).
- Rename `extraction.max_extract_pages` → `extraction.max_pages` with
TOML key and env var deprecation migrations.
- All old env var names still accepted with deprecation warnings.
- Update `show config` dump to derive fallback env var sources from the
same rename table.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sets the maximum file size for document imports, overriding the config file
158
191
value. Accepts unitized strings or bare integers (bytes). Must be positive:
159
192
160
193
```sh
161
-
exportMICASA_MAX_DOCUMENT_SIZE="100 MiB"
194
+
exportMICASA_DOCUMENTS_MAX_FILE_SIZE="100 MiB"
162
195
micasa # allows documents up to 100 MiB
163
196
```
164
197
165
-
### `MICASA_CACHE_TTL`
198
+
### `MICASA_DOCUMENTS_CACHE_TTL`
166
199
167
200
Sets the document cache lifetime, overriding the config file value. Accepts
168
201
day-suffixed strings (`30d`), Go durations (`720h`), or bare integers
169
202
(seconds). Set to `0` to disable eviction:
170
203
171
204
```sh
172
-
exportMICASA_CACHE_TTL=7d
205
+
exportMICASA_DOCUMENTS_CACHE_TTL=7d
173
206
micasa # evicts cache entries older than 7 days
174
207
```
175
208
176
-
### `MICASA_CACHE_TTL_DAYS`
209
+
### `MICASA_DOCUMENTS_CACHE_TTL_DAYS`
177
210
178
-
Deprecated. Use `MICASA_CACHE_TTL` instead. Accepts a bare integer
179
-
interpreted as days. Cannot be set alongside `MICASA_CACHE_TTL`.
211
+
Deprecated. Use `MICASA_DOCUMENTS_CACHE_TTL` instead. Accepts a bare integer
212
+
interpreted as days. Cannot be set alongside `MICASA_DOCUMENTS_CACHE_TTL`.
180
213
181
214
### Platform data directory
182
215
@@ -274,7 +307,7 @@ model = "qwen3"
274
307
# text_timeout = "30s"
275
308
276
309
# Maximum pages to OCR for scanned documents. 0 = no limit. Default: 0.
277
-
#max_extract_pages = 0
310
+
#max_pages = 0
278
311
279
312
# Set to false to disable LLM-powered extraction.
280
313
# When disabled, no structured data is extracted from documents.
@@ -288,7 +321,7 @@ model = "qwen3"
288
321
# run; after that the database value is authoritative (portable DB files keep
289
322
# their currency even when opened on a machine with different locale settings).
290
323
# Auto-detected from LC_MONETARY/LANG if not set. Default: USD.
291
-
# Override with MICASA_CURRENCY env var.
324
+
# Override with MICASA_LOCALE_CURRENCY env var.
292
325
# currency = "USD"
293
326
```
294
327
@@ -359,7 +392,7 @@ dates, vendor matching) from uploaded documents.
359
392
|-----|------|---------|-------------|
360
393
|`model`| string | (chat model) |**Deprecated.** Use `[llm.extraction] model` instead. Falls back to `llm.model` if empty. |
361
394
|`text_timeout`| string |`"30s"`| Max time for `pdftotext` to run. Go duration syntax, e.g. `"1m"`. Increase for very large PDFs. |
362
-
|`max_extract_pages`| int |`0`| Maximum pages to OCR per scanned document. 0 means no limit. |
395
+
|`max_pages`| int |`0`| Maximum pages to OCR per scanned document. 0 means no limit. |
363
396
|`enabled`| bool |`true`| Set to `false` to disable LLM-powered extraction. When disabled, no structured data is extracted from documents. |
364
397
|`thinking`| bool |`false`|**Deprecated.** Use `[llm.extraction] thinking` instead. |
365
398
@@ -375,7 +408,7 @@ fields in the application.
375
408
Currency resolution order (highest to lowest):
376
409
377
410
1. Database value (authoritative once set -- makes the DB file portable)
378
-
2.`MICASA_CURRENCY` environment variable
411
+
2.`MICASA_LOCALE_CURRENCY` environment variable
379
412
3.`[locale] currency` config value
380
413
4. Auto-detect from `LC_MONETARY` or `LANG` locale
381
414
5.`USD` fallback
@@ -455,4 +488,4 @@ restarts. These are controlled through the UI rather than config files:
455
488
|------------|---------|---------------|
456
489
| Dashboard on startup | Shown | Press <kbd>D</kbd> to toggle; your choice is remembered |
457
490
| LLM model | From config | Changed automatically when you switch models in the chat interface |
458
-
| Currency | USD | Set via `[locale] currency` in config, `MICASA_CURRENCY` env var, or auto-detected from system locale. Persisted to the database on first use |
491
+
| Currency | USD | Set via `[locale] currency` in config, `MICASA_LOCALE_CURRENCY` env var, or auto-detected from system locale. Persisted to the database on first use |
0 commit comments