scaphandre
scaphandre copied to clipboard
Enable scaphandre to read its configuration from a file
Problem
All the configuration has to be passed as flags in the command line today.
Solution
I'd like to be able to write the behaviour I want Scaphandre to adopt in a file, give it this file's path to read (with --config for example).
Hi, I believe getting config from environment variables may be a related topic.
As far as i can read rust (not much yet ;-)) I understand that scaphandre uses clap (https://docs.rs/clap/2.33.3/clap/) to parse it's command line arguments.
Do you think that a integrating a library like clap_conf (https://lib.rs/crates/clap_conf) could help unifying cli args, env vars and config file ?
Hi ! Absolutely. Thanks for sharing this, this library seems to be worth a shot !
Hello, coming with clap 4.0 (coming in #234), we can add an env directive to get value from an env variable. https://docs.rs/clap/4.0.19/clap/builder/struct.Arg.html#method.env It seems pretty simple to add, not intrusive and avoids a new dependency. Used with a dotenv file it could be a friendly alternative.
Hi! Clap can be "augmented" with argfile in order to load arguments from a file, it seems to do what you're looking for.
Thanks to @TheElectronWill work on clap, it should be done for 1.1 release