| 1 | package config |
| 2 | |
| 3 | // HistorySearchMaxMB returns the user-global history_search.max_mb setting |
| 4 | // (0 when unset or unreadable). It decodes only that table: adding a typed |
| 5 | // field to Config would push ratcheted config.go/render.go over their |
| 6 | // repolint budgets, and the setting is consumed by internal/historycatalog |
| 7 | // only (#8717). A settings-UI save may drop the manually written section. |
| 8 | func HistorySearchMaxMB() int { |
| 9 | path := userConfigLoadPath() |
| 10 | if path == "" { |
| 11 | return 0 |
| 12 | } |
| 13 | var partial struct { |
| 14 | HistorySearch struct { |
| 15 | MaxMB int `toml:"max_mb"` |
| 16 | } `toml:"history_search"` |
| 17 | } |
| 18 | if _, err := decodeTOMLFile(path, &partial); err != nil { |
| 19 | return 0 |
| 20 | } |
| 21 | return partial.HistorySearch.MaxMB |
| 22 | } |
| 23 |