9 Commits

Author SHA1 Message Date
b16df4e1a9 fix(safety): eliminate TOCTOU race in readFile, guard WriteConfig, DRY getters
- readFile now opens the file first, then stats via the fd (no race
  between stat and open). Uses toml.NewDecoder instead of DecodeFile.
- WriteConfig returns an error if no config file has been set.
- YAML WriteConfig now calls enc.Close() to flush properly.
- Extract resolve() helper to deduplicate the combinedConfig→envConfig
  fallback pattern across all 9 getter methods.
2026-03-01 23:44:16 +00:00
9ff1fdc5ee fix!: SetEnvPrefix now re-reads env vars with prefix stripping
SetEnvPrefix was broken: it set the prefix string but never re-read
environment variables. This meant collapse() and SetDefault() couldn't
match prefixed env vars to their unprefixed config keys, so defaults
always won over env vars.

The fix makes SetEnvPrefix behave identically to WithEnvPrefix: it
re-reads os.Environ(), strips the prefix from matching keys, and
stores the stripped keys in envConfig. The envPrefix field is removed
entirely since keys are always pre-stripped.

BREAKING CHANGE: SetEnvPrefix now filters env vars to only those
matching the prefix (previously all env vars were accessible).
This matches the documented and expected behavior.
2026-03-01 20:42:30 +00:00
c4c05732f5 update to fixup some race conditions 2026-01-24 20:29:43 -05:00
59b8a9078f fix config => jety 2023-11-03 17:22:02 -07:00
95bdc4d109 upadte switch for any 2023-11-03 12:27:04 -07:00
62dd32f61b fix slice returners 2023-11-03 04:16:29 -07:00
1d2bf65621 add env prefix to getters 2023-11-03 01:29:35 -07:00
610b979966 optimistic writeback and pessimistic read 2023-11-03 00:56:56 -07:00
58d195f1eb refactor to getters and jety 2023-11-02 22:39:15 -07:00