48 Commits

Author SHA1 Message Date
6ec3d79700 add dot-accessor notation v0.4.0 2026-03-20 05:54:41 -04:00
a81a2027ae refactor(api)!: remove Delete method from public API
Environment variables are unaffected by Delete, making it misleading —
callers would expect a key to be fully gone but env vars would still
resolve. Sub is the better abstraction for scoped config.
2026-03-09 19:36:31 +00:00
ff8a3444f1 Merge pull request #5 from taigrr/cd/ci-updates-and-delete-method
feat(api): add Delete and Sub methods, update CI workflows
2026-03-08 14:30:09 -04:00
c8cbb72ed7 feat(api): add Delete and Sub methods, update CI workflows
- Add Delete(key) to remove keys from all config layers
- Add Sub(key) to get a scoped ConfigManager for nested sections
- Update CodeQL workflow actions to v4/v5/v3
- Update govulncheck workflow checkout to v4
- Remove boilerplate comments from CodeQL workflow
- Add comprehensive tests for both new methods
- Update README with Sub() usage example and API docs
2026-03-07 11:03:48 +00:00
8b154b58ba Merge pull request #4 from taigrr/cd/getters-and-docs
feat(getters): add GetFloat64 and GetInt64, fix docs
2026-03-06 05:34:09 -05:00
dd7e2e3ecb feat(getters): add GetFloat64 and GetInt64, fix docs
- Add GetFloat64 and GetInt64 methods to ConfigManager and package-level API
- Fix README precedence: actual order is Set > env > file > default
  (was incorrectly documented as file > env > default)
- Fix GetStringMap return type in API table: map[string]any, not map[string]string
- Bump Go to 1.26.1
- Add tests for all new getters (coverage 94.7% → 95.2%)
2026-03-06 10:32:42 +00:00
60253426ae docs: update README for v0.3.0
- Add CI badges (test + govulncheck)
- Bump minimum Go version to 1.26
- Add IsSet, AllKeys, AllSettings to API table
- Remove outdated migration guide
2026-03-02 00:13:33 +00:00
f338b2c662 ci: drop Go 1.24 matrix, only test 1.26 2026-03-02 00:10:26 +00:00
e5f7cc7fae ci: add test workflow with race detector and staticcheck v0.3.0 2026-03-02 00:09:51 +00:00
91b69246fa refactor: extract parseEnv helper, add doc comments, fix param shadow
- Extract parseEnv() to deduplicate env parsing in NewConfigManager,
  WithEnvPrefix, and SetEnvPrefix (was 3 copies of the same logic).
- Add doc comments to ConfigMap, ConfigManager, NewConfigManager,
  WithEnvPrefix, SetEnvPrefix, IsSet, AllKeys, AllSettings.
- Rename configType parameter in SetConfigType to avoid shadowing
  the configType type.
2026-03-01 23:45:17 +00:00
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
5aadc84d50 feat: add IsSet, AllKeys, AllSettings; fix env precedence for file-only keys
- collapse() now applies env vars for keys present in fileConfig, not
  just defaultConfig. Previously, env vars couldn't override file values
  unless a default was also set for that key.
- SetDefault no longer pollutes overrideConfig; it correctly resolves
  the value by checking override > env > file > default.
- Remove unused explicitDefaults field and UseExplicitDefaults method.
- Add IsSet, AllKeys, AllSettings methods + package-level wrappers.
- Add missing package-level wrappers: Get, SetBool, SetString,
  SetConfigDir, WithEnvPrefix.
- Add tests for all new methods and the env-over-file-without-default
  fix.
2026-03-01 23:43:16 +00:00
7335ecd39c Merge pull request #3 from taigrr/cd/fix-precedence
fix(precedence): env vars now correctly override config file values
v0.2.1
2026-03-01 18:40:39 -05:00
4c8d8960be fix(precedence): env vars now correctly override config file values
The documented precedence is Set > env > file > defaults, but collapse()
was using maps.Copy(ccm, mapConfig) which let file values (and Set values,
stored in the same map) unconditionally overwrite env values.

Split mapConfig into fileConfig (from ReadInConfig) and overrideConfig
(from Set/SetString/SetBool). collapse() now applies layers in correct
order: defaults, then file, then env (for known keys), then overrides.

Added TestPrecedenceChain to verify the full layering.
2026-03-01 23:37:24 +00:00
6852ffbebb Merge pull request #2 from taigrr/cd/fix-set-env-prefix
fix!: SetEnvPrefix now re-reads env vars with prefix stripping
v0.2.0
2026-03-01 15:42:57 -05: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
7f2320f204 Merge pull request #1 from taigrr/cd/update-go-deps-and-tests
chore: update Go 1.26.0, deps, and test coverage to 97%
2026-02-24 02:08:49 -05:00
94b97a5825 chore(deps): update Go to 1.26.0, toml to v1.6.0, add tests for 97% coverage 2026-02-24 07:02:22 +00:00
21ea264b79 add nested env var doc 2026-01-24 20:58:47 -05:00
c4c05732f5 update to fixup some race conditions v0.1.0 2026-01-24 20:29:43 -05:00
59b8a9078f fix config => jety v0.0.12 2023-11-03 17:22:02 -07:00
550537be3b setting using default vkey v0.0.11 2023-11-03 16:39:30 -07:00
95bdc4d109 upadte switch for any v0.0.10 2023-11-03 12:27:04 -07:00
64d37d936f add check for empty config file v0.0.9 2023-11-03 04:40:53 -07:00
62dd32f61b fix slice returners v0.0.8 2023-11-03 04:16:29 -07:00
9c5923bd4e fix mutex v0.0.7 2023-11-03 03:42:21 -07:00
5643d4d262 send back custom error v0.0.6 2023-11-03 03:18:37 -07:00
ee74c94359 add config collapse after reading in v0.0.5 2023-11-03 03:01:51 -07:00
e84645ccfa fix readme order 2023-11-03 02:25:19 -07:00
b2e7785e00 fix inverted negation v0.0.4 2023-11-03 02:24:06 -07:00
ef3350d66d add defaults to config file v0.0.3 2023-11-03 02:20:08 -07:00
ac7820de64 use flattened config instead of lowercased v0.0.2 2023-11-03 01:52:37 -07:00
0c9b84b049 typo v0.0.1 2023-11-03 01:30:45 -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
0fc1bf396d add withEnvPrefix 2023-11-02 22:45:16 -07:00
c7e8bbf52c type block, remove ae param 2023-11-02 22:41:00 -07:00
58d195f1eb refactor to getters and jety 2023-11-02 22:39:15 -07:00
47821829af clarify readme, extract setters 2023-11-02 22:35:05 -07:00
89b969ee2c add funding / CI 2023-11-02 21:23:44 -07:00
26ecbb006d add type coercions 2023-11-02 19:09:55 -07:00
2cfada117b work on writing and reading configs 2023-11-02 11:35:10 -07:00
5eb722ff0f move default into separate file 2023-11-02 10:40:28 -07:00
1a964b3d13 load env into cm 2023-11-02 00:43:01 -07:00
2c27fa61dc add initial function signatures 2023-11-02 00:01:52 -07:00
0b91893d31 go mod init, add stubbed funcs 2023-11-01 23:33:47 -07:00
e104e0f686 rm 2023-10-30 19:00:04 -07:00
018654258b add license 2023-10-25 23:46:13 -07:00