Skip to content

feat: comprehensive configuration validation and hot-reload capability - #49

Merged
MaryammAli merged 1 commit into
Proof-Stell:mainfrom
Xhristin3:feat/config-validation-hot-reload
Jul 23, 2026
Merged

feat: comprehensive configuration validation and hot-reload capability#49
MaryammAli merged 1 commit into
Proof-Stell:mainfrom
Xhristin3:feat/config-validation-hot-reload

Conversation

@Xhristin3

@Xhristin3 Xhristin3 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Description

Resolves #48
Closes #48

Adds comprehensive configuration validation and hot-reload capability to the ProofStell service.

Changes

Configuration Validation

  • Added , , wrapper types with automatic validation at construction
  • Enforce for both global and per-issuer rate limit tiers
  • Bounds checking for all timeout/delay values (max 300s)
  • Log level validation against supported levels
  • Config versioning with and

Hot-Reload

  • Added -based config channels (, )
  • New endpoints: GET /config/status and POST /config/reload
  • Background config watcher task that applies updates at runtime

Testing

  • 14 new tests covering validations, wrapper types, versioning, and hot-reload

Verification

  • cargo build succeeds
  • All tests pass

Implements the full scope of issue Proof-Stell#48:

Strongly-typed configuration wrappers:
- Add ValidatedUrl, ValidatedRedisUrl, ValidatedPort wrapper types
- Each validates format at construction time with clear error messages

Rate-limit invariant enforcement:
- Add burst >= per_second validation for both global and per-issuer tiers
- Prevents misconfiguration where burst is less than the refill rate

Bounds checking:
- Add MAX_TIMEOUT_MS (300s) upper bound for all delay/timeout values
- Add log level validation (trace/debug/info/warn/error only)
- Port validation with explicit min/max constants

Config versioning:
- Add CONFIG_VERSION constant and ConfigVersion type
- Rollback detection via validate_compatible()
- Version exposed via config status endpoint

Hot-reload mechanism:
- ConfigWatcher using tokio::sync::watch channel
- POST /config/reload endpoint to trigger reload from env
- GET /config/status endpoint exposing current version
- Background task applies updates to dependent services

Documentation:
- All 30+ environment variables documented with purpose, defaults, and validation rules
- Config versioning policy documented

Tests:
- 14 new tests covering all validation rules, wrapper types, versioning, and hot-reload

@MaryammAli MaryammAli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MaryammAli
MaryammAli merged commit 22493cc into Proof-Stell:main Jul 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Comprehensive Configuration Validation and Hot-Reload Capability

2 participants