Skip to content

feat(config): _FILE support for Revolut secrets#140

Merged
ntatschner merged 1 commit into
nextfrom
feat/revolut-config-file-support
May 31, 2026
Merged

feat(config): _FILE support for Revolut secrets#140
ntatschner merged 1 commit into
nextfrom
feat/revolut-config-file-support

Conversation

@ntatschner
Copy link
Copy Markdown
Collaborator

Summary

  • RevolutConfig::from_env now uses read_env_or_file() for REVOLUT_API_KEY and REVOLUT_WEBHOOK_SECRET, matching the docker-secrets convention already used by MINIO_SECRET_KEY_FILE, SPICEDB_PRESHARED_KEY_FILE, ROADMAP_GH_*_FILE.
  • Signature widened Option<Self>Result<Option<Self>> so file-read errors propagate instead of silently degrading to "not configured" — matches the rest of the config types.
  • Backward-compatible: inline env wins over _FILE when both are set (covered by a regression test).
  • Docs: REVOLUT-INTEGRATION-PLAN.md setup checklist replaces the dead "Dashboard → Webhooks → Add webhook" steps (Revolut removed that UI in the 2024-09-01 API version) with the equivalent POST /api/1.0/webhooks curl call. Also flags signing_secret recovery via GET /webhooks/{id} and webhook_id retention.

Why now

Unblocks the starstats-api deploy on the homelab compose stack — secrets are mounted as files at /run/secrets/revolut_*, but the previous RevolutConfig::from_env only read inline env vars, so the server logged "Revolut Business merchant API not configured" on every boot and /v1/donate/checkout returned 503. Compose-side wiring lands in home-servers-build once this PR merges and :latest rebuilds.

Test plan

  • cargo test -p starstats-server config::tests — 15 tests pass (5 new for Revolut: degraded path, partial-config rejection, inline+defaults, _FILE round-trip with CRLF trim, inline-overrides-file)
  • cargo fmt -p starstats-server clean
  • cargo clippy -p starstats-server --bin starstats-server -- -D warnings clean
  • Smoke: after merge + promote, set REVOLUT_API_KEY_FILE=/run/secrets/revolut_api_key + REVOLUT_WEBHOOK_SECRET_FILE=/run/secrets/revolut_webhook_secret on prod, restart starstats-api, watch for Revolut Business merchant API configured boot log, hit /v1/donate/tiers to confirm degraded path lifts, then click £3 on /support end-to-end.

Unblocks the donate routes on the homelab compose stack, which mounts
secrets as files via $SECRETSDIR rather than passing values inline.
RevolutConfig::from_env now uses the same read_env_or_file helper as
SpicedbConfig / MinioConfig / RoadmapPipelineConfig — REVOLUT_API_KEY
and REVOLUT_WEBHOOK_SECRET each accept either the inline value or a
_FILE variant pointing at a Docker-secrets-style mount.

Inline env wins over _FILE when both are set (backward-compatible for
any existing deploy that passes values inline).

Signature widened Option<Self> -> Result<Option<Self>> so file-read
errors propagate instead of silently degrading to "not configured" —
matches the rest of the config types.

Updates docs/REVOLUT-INTEGRATION-PLAN.md to replace the dead "Dashboard
-> Webhooks -> Add webhook" steps (Revolut removed that UI in the
2024-09-01 API version) with the equivalent POST /api/1.0/webhooks
curl call.
@ntatschner ntatschner merged commit eda4fc1 into next May 31, 2026
10 checks passed
@ntatschner ntatschner deleted the feat/revolut-config-file-support branch May 31, 2026 13:34
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.

1 participant