diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-12 21:20:00 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-12 21:21:53 +0000 |
| commit | 1948312d40f34fca868d1ef6d6d94e165c09738c (patch) | |
| tree | f25f930785145023be6fe33e52904a5d8383a62d /src/git/sync.rs | |
| parent | 82b56c37b26a2fac1a294873e539b19b9325dca6 (diff) | |
refactor(config): validate eagerly at startup and remove Result from runtime config methods
Refactors configuration validation to fail fast on fatal errors at startup
while gracefully handling recoverable issues (e.g., malformed whitelist entries).
Changes:
- Add Config::validate() for eager validation called immediately after load
- Remove Result<> from archive_config() and repository_config() methods
- WhitelistEntry::parse_whitelist() skips invalid entries with warnings
- Validate relay_owner_nsec format in Config::validate()
- Update all call sites to remove Result handling from config getters
Benefits:
- Fatal config errors (incompatible settings) fail at startup, not runtime
- Recoverable errors (bad whitelist entries) logged as warnings and skipped
- No Result handling scattered throughout runtime code after validation
- Config methods safe to call without error handling after validate()
Testing:
- Add 7 new tests for validation edge cases and error handling
- Total config tests: 40 (up from 33)
- All 320 library tests passing
Breaking change: Config users must call config.validate() after Config::load()
to ensure configuration is valid. This is enforced in main.rs.
Diffstat (limited to 'src/git/sync.rs')
0 files changed, 0 insertions, 0 deletions