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

Refactor config value retrieval #913

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

matejmode
Copy link
Collaborator

@matejmode matejmode commented Dec 12, 2023

Description

This PR is (currently) PROOF OF CONCEPT (tests are missing). The config could be rewritten so that it is more modular.

After this change of structure we can print just the relevant values for the command printing only the flags which are actually used by it. It could be done by iterating over specifiedFlags

func (cc *configContext) reportNewConfig(specifiedFlags map[string]bool) error {

There could either be generic message for each config value or there could be a map with predefined notifications.

@Lubomir-Jahn what do you think? If it works could you please expand on my initial work and finish this off?

Issues

This will solve #886 for not just chainid but for every flag.

Type of change

  • New feature (non-breaking change which adds functionality)

Copy link
Collaborator

@wsodsong wsodsong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Let's also add a simple test case checking whether createConfigFromFlags returns value as expected. Should @Lubomir-Jahn help you with this?

Comment on lines +118 to +120
if isSpecified {
specifiedFlags[flagName] = true
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if isSpecified {
specifiedFlags[flagName] = true
}
specifiedFlags[flagName] = isSpecified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants