Configuration Loader, Secret File Access & Health Checks #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implement the typed TOML configuration loader for
life serveandlifeCLI, supporting mounted secret files, strict path validation, fail-fast configuration checks, and the foundational/health/liveand/health/readydiagnostic endpoints andlife doctorCLI command.Background & Technical Rationale
The Life service requires strict configuration hygiene to prevent deployment accidents, credential leakage, and silent semantic divergence:
argv), container environment variables, or image layers. Instead, configuration must reference explicit mounted secret file paths (*_file), reading the secret value at runtime and trimming trailing whitespace/newlines. Permissions must be validated.planning.timezonemust strictly match theradicale.timezone. A silent divergence between planning and calendar timezones causes corrupted scheduling boundaries./health/livechecks purely that the Axum HTTP process is running and responding./health/readyverifies that configuration is valid, schema migrations have run, and the local SQLite journal storage is writable. Degradation of optional upstream backends (e.g. Hindsight or Jev) is reported as a capability warning, not an unhealthy process restart trigger.life doctor) must never leak secret tokens, passwords, raw host paths, or personal collection contents.Exact Technical References & Specifications
Configuration Contract & Tables
From
docs/technical/operations-security.md#configuration-contract:Health Probes and Diagnostics
From
docs/technical/operations-security.md#health-migrations-and-shutdown:CLI Doctor Command
From
docs/technical/cli-api.md#command-to-route-table:| life doctor | GET /health/live and GET /health/ready | read for detailed readiness |From
docs/technical/cli-api.md#transport-and-common-contract:Deployment Scenario D02 Requirement
From
docs/technical/verification.md#deployment-scenarios:Formal Section Citations
docs/technical/operations-security.md#configuration-contract: Defines the TOML sections, required keys, secret loading rules, and timezone alignment.docs/technical/operations-security.md#health-migrations-and-shutdown: Details health check separation and backend degradation isolation.docs/technical/cli-api.md#command-to-route-table: Defineslife doctorroute mapping and sanitization.docs/technical/verification.md#deployment-scenarios: Formulates normative scenario D02 for configuration validation.What to Build (Step-by-Step)
Implement Configuration Models (
src/config.rs):#[serde(deny_unknown_fields)]for strict schema enforcement:ServiceConfigcontainingServerConfig,RadicaleConfig,Option<HindsightConfig>,Option<JevConfig>,StorageConfig,PlanningConfig.ClientConfigFilecontainingClientServiceConfig,ClientDisplayConfig.read_secret_file(path: &Path) -> Result<Zeroizing<String>, ConfigError>that reads file content, verifies it is valid UTF-8, trims trailing\r\nor\n, ensures it is non-empty, and wraps secret bytes in a zeroizing container (e.g.zeroize::Zeroizing).chrono_tz::Tz::from_str.planning.timezone == radicale.timezone.planning.collection_idsreference known keys inradicale.collections.Implement Health Endpoints in Axum (
src/api.rs):GET /health/live:{"status": "ok"}.GET /health/ready:dependency_unavailableif storage is unwritable or initialization incomplete.Implement
life doctorCLI Command (src/cli.rs):/health/liveand/health/ready.process: status, uptime, version.storage: sqlite status, journal mode, integrity flag.capabilities: radicale, hindsight, jev reachability.ResponseEnvelopeonstdout.Integration Tests for Configuration Validation (Scenario D02):
Fake/Zone): verify error and exit code 2.*_filepath: verify failure and exit code 2, ensuring the error message does not leak sensitive environment details.Acceptance Criteria
Invalid/Zone) causes startup to fail with exit code 2.planning.timezoneandradicale.timezonecauses startup to fail with exit code 2./health/livereturns HTTP 200 as long as the process is alive./health/readyreturns HTTP 200 when storage is writable and migrations are complete, even if Hindsight or Jev are disabled/unreachable (verifying Scenario D07: distinguishing write/storage failure from optional backend degradation).life doctor --jsonoutputs diagnostic JSON containing sanitized system status without leaking secret tokens or sensitive host paths.docs/technical/verification.md.Blocked by
Issue #003: Configuration Loader, Secret File Access & Health Checksto Configuration Loader, Secret File Access & Health Checks