vinteumorg / Floresta

A fully-validating Bitcoin node powered by Utreexo, with an integrated Electrum Server
MIT License
177 stars 37 forks source link

Consider using `configure_me` for configuration #231

Open Kixunil opened 2 months ago

Kixunil commented 2 months ago

configure_me is a configuration library optimized for configuring daemons (as opposed to being focused on manually invoked CLI tools) that takes care of consistent argument parsing, env variable parsing and toml config file parsing. It also correctly handles various styles of accepting an option (--foo val, --foo=val, -f val, -f=val, -fval - also with multiple flags in one arg), reports errors quite nicely (WIP to make it even better), allows automatically generating man pages, correctly handles OsString/PathBuf arguments, has numerous commonly-used features and reasonably conservative MSRV (Debian stable, basically).

It's already used by electrs and other projects. I think it would be a great fit here since you're writing a daemon. Feel free to reach out if you need help with it or some special features. (There's a slight complication around build scripts&stuff.)

Davidson-Souza commented 2 months ago

Thanks for bringing this to my attention, this crate looks amazing! I've been meaning to get all cli options also exposed for the config file, but it's pretty annoying and requires a ton of duplication.

Definitely something I'm looking forward to implement

Kixunil commented 2 months ago

but it's pretty annoying and requires a ton of duplication

Exactly, configure_me removes the duplication entirely.