Skip to content
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

Merged
merged 6 commits into from
Sep 4, 2024

Conversation

m-lord-renkse
Copy link
Contributor

Description

Improve the groups for ethplorer and blockscout inspired by the CoinGecko configuration done in: #2909

How to test

1.Unit test

@m-lord-renkse m-lord-renkse marked this pull request as ready for review August 23, 2024 13:51
@m-lord-renkse m-lord-renkse requested a review from a team as a code owner August 23, 2024 13:51
Copy link

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.

@github-actions github-actions bot added the stale label Aug 31, 2024
pub blockscout_api_key: Option<String>,
/// The blockscout configuration.
#[clap(flatten)]
pub blockscout: Blockscout,
Copy link
Contributor

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.

Copy link
Contributor

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 Options 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>,
Copy link
Contributor Author

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.

@m-lord-renkse m-lord-renkse force-pushed the improve-config-groups branch 2 times, most recently from 521f246 to 9e4f68b Compare September 2, 2024 12:40
@github-actions github-actions bot removed the stale label Sep 3, 2024
@m-lord-renkse m-lord-renkse merged commit dae1bd6 into main Sep 4, 2024
10 checks passed
@m-lord-renkse m-lord-renkse deleted the improve-config-groups branch September 4, 2024 07:11
@github-actions github-actions bot locked and limited conversation to collaborators Sep 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants