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

feat(cmd): add transport switch in flag start daemon #1681

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Ja7ad
Copy link
Contributor

@Ja7ad Ja7ad commented Feb 2, 2025

Description

Add transport switch in flag start pactus-daemon.

Related issue(s)

@Ja7ad Ja7ad requested review from b00f and alidevjimmy February 2, 2025 08:19
@Ja7ad Ja7ad changed the title feat: add transport switch in flag start daemon feat(cmd): add transport switch in flag start daemon Feb 2, 2025
Copy link

codecov bot commented Feb 2, 2025

Codecov Report

Attention: Patch coverage is 1.69492% with 58 lines in your changes missing coverage. Please review.

Project coverage is 76.34%. Comparing base (86a8ba9) to head (7154833).
Report is 51 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1681      +/-   ##
==========================================
+ Coverage   75.07%   76.34%   +1.26%     
==========================================
  Files         234      242       +8     
  Lines       12156    18620    +6464     
==========================================
+ Hits         9126    14215    +5089     
- Misses       2582     3943    +1361     
- Partials      448      462      +14     

@b00f
Copy link
Collaborator

b00f commented Feb 6, 2025

I feel we can simplify it even further. Instead of defining a modifier per config, we could have a function like func configModifier(conf *config) *config. This function would take the entire config and modify it after loading.

) {
conf, gen, err := MakeConfig(workingDir)
func StartNode(workingDir string, passwordFetcher func(*wallet.Wallet) (string, bool),
confModifiers ...config.Modifier,
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
confModifiers ...config.Modifier,
modifier func(*config.Config) *config.Config,

Copy link
Contributor Author

@Ja7ad Ja7ad Feb 7, 2025

Choose a reason for hiding this comment

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

@b00f Why modifier return Config? Modifier just applied changes on loaded configuration.

@@ -498,6 +498,10 @@ func MakeConfig(workingDir string) (*config.Config, *genesis.Genesis, error) {
conf.WalletManager.ChainType = chainType
conf.WalletManager.WalletsDir = walletsDir

for _, modify := range confModifiers {
Copy link
Collaborator

Choose a reason for hiding this comment

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

if modifier != nil {
conf = modifier(conf)
}

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.

Add transport switch in flag start pactus-daemon
2 participants