Closed davidpdrsn closed 2 years ago
if one end up with a lot of small service apps using this and wanting to reduce boilerplate with them one could add this as an optional clap
feature that has a small conversion struct from this config to a clap-compatible config. for a fully batteries-included (but optional) approach.
but starting without it and with this feels like the easiest and cleanest.
When integrating this into our internal services we ran into a few oddities that were caused by having
#[derive(clap::Parser)]
onConfig
:#[clap(default_value = "...")]
.Config
'sDefault
implementation should call clap or not. Getting env vars inDefault
is kinda odd but if you don't you have to duplicate the default values in the code.With this change
Config
is becomes just a regular struct. Users can then build then own CLI arg parsing and convert between their config and our config however they want. Thats a bit less convenient but probably worth it overall.