Skip to content

check and merge config from toml and env#1962

Draft
asmogo wants to merge 3 commits into
cashubtc:mainfrom
asmogo:feat/check-config
Draft

check and merge config from toml and env#1962
asmogo wants to merge 3 commits into
cashubtc:mainfrom
asmogo:feat/check-config

Conversation

@asmogo
Copy link
Copy Markdown
Collaborator

@asmogo asmogo commented May 13, 2026

Description


Adds upfront, fail-fast validation of cdk-mintd settings after TOML + env-var merge, so misconfiguration produces a clear error pointing at both the offending TOML key and env var instead of a silent default or a confusing downstream crash.

Notes to the reviewers


  • New validate_settings() covers listen address, signing source (mnemonic / seed length / signatory URL), per-backend lightning config, database, auth, management-RPC, and Prometheus.
  • #[serde(default)] added across config structs so partial TOML files merge cleanly with defaults and env vars.
  • Settings::new split into try_new (Result) + new (panics on any error) — removes the old silent-fallback-to-defaults footgun.
  • Replaces an .expect() panic in Prometheus server startup with a propagated error.
  • Adds a shared test-utils module (env-mutex + unique temp dirs) and a full set of negative tests for every validator branch.

Suggested CHANGELOG Updates

CHANGED

ADDED

REMOVED

FIXED


Checklist

  • I followed the code style guidelines
  • I ran just quick-check before committing
  • If the Wallet API was modified (added/removed/changed), I have reflected those changes in the FFI bindings (crates/cdk-ffi)

asmogo added 2 commits May 13, 2026 09:05
- check seed
- no silent fallback to default config
@github-project-automation github-project-automation Bot moved this to Backlog in CDK May 13, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

❌ Patch coverage is 85.60606% with 76 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.44%. Comparing base (8ce06b1) to head (d3a4185).

Files with missing lines Patch % Lines
crates/cdk-mintd/src/lib.rs 85.40% 75 Missing ⚠️
crates/cdk-mintd/src/config.rs 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1962      +/-   ##
==========================================
+ Coverage   65.16%   65.44%   +0.27%     
==========================================
  Files         330      330              
  Lines       56742    57254     +512     
==========================================
+ Hits        36976    37469     +493     
- Misses      19766    19785      +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant