-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EASY] Improve config group for blockscout and ethplorer #2924
Conversation
This pull request has been marked as stale because it has been inactive a while. Please update this pull request or it will be automatically closed. |
pub blockscout_api_key: Option<String>, | ||
/// The blockscout configuration. | ||
#[clap(flatten)] | ||
pub blockscout: Blockscout, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the groups themselves be optional and the individual fields in the struct be required?
That way you only have the blockscout
struct if everything is configured correctly and don't have to map optionals awkwardly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this can be achieved by making the fields not Option
s but setting required=false
on the field macro.
@@ -241,7 +241,7 @@ pub struct Arguments { | |||
pub fn display_secret_option<T>( | |||
f: &mut Formatter<'_>, | |||
name: &str, | |||
option: &Option<T>, | |||
option: Option<&T>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
&Option<T>
is an anti-pattern.
521f246
to
9e4f68b
Compare
9e4f68b
to
8c1ba7d
Compare
Description
Improve the groups for
ethplorer
andblockscout
inspired by the CoinGecko configuration done in: #2909How to test
1.Unit test