Skip to content

Add TOML config file support with layered CLI overrides and validation - #153

Open
dcorral wants to merge 1 commit into
RGB-Tools:masterfrom
dcorral:upstream-toml-config
Open

Add TOML config file support with layered CLI overrides and validation#153
dcorral wants to merge 1 commit into
RGB-Tools:masterfrom
dcorral:upstream-toml-config

Conversation

@dcorral

@dcorral dcorral commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Adds support for configuring the node via a TOML file, loaded from <storage_directory_path>/config.toml or the path given with --config. Values are resolved in order: built-in defaults, then the config file, then explicit CLI options. All current defaults are unchanged.

This moves the hardcoded policy constants (fee rate, UTXO size/count, channel confirmations, HTLC minimum, channel capacity bounds, swap fee cap, CLTV deltas, timers) and the LDK-inherited channel knobs (cltv_expiry_delta, to_self_delay, forwarding fees, dust exposure, in-flight limits, accept_forwards_to_priv_channels) into a [section]-based config, so nodes can be tuned without recompiling. The existing CLI args are also readable from the file, with the CLI taking precedence.

Every value is validated at startup (errors name the offending key) and unknown keys are rejected. All keys are documented with their defaults in sample-config.toml.

@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.02985% with 36 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.54%. Comparing base (6887cbf) to head (46193a8).

Files with missing lines Patch % Lines
src/args.rs 86.50% 22 Missing ⚠️
src/routes.rs 88.00% 9 Missing ⚠️
src/config/file.rs 66.66% 4 Missing ⚠️
src/config/mod.rs 99.67% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #153      +/-   ##
==========================================
+ Coverage   87.78%   88.54%   +0.75%     
==========================================
  Files          16       18       +2     
  Lines        8459     9000     +541     
==========================================
+ Hits         7426     7969     +543     
+ Misses       1033     1031       -2     
Flag Coverage Δ
rust 88.54% <94.02%> (+0.75%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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

None yet

Development

Successfully merging this pull request may close these issues.

1 participant