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

cli: allow to override consensus wallet path #3198

Closed
wants to merge 2 commits into from

Conversation

ixje
Copy link
Contributor

@ixje ixje commented Nov 13, 2023

Problem

close #3179

Solution

as per #3179 (comment)

I wasn't sure if it made sense to add options.RelativePath here

cfgFlags := []cli.Flag{options.Config, options.ConfigFile}

so I left it out until told otherwise.

Copy link
Member

@AnnaShaleva AnnaShaleva left a comment

Choose a reason for hiding this comment

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

You can also apply the same flag to our VM CLI.

// RelativePath is a flag for commands that use node configuration and provides
// the path to the consensus wallet instead of reading it from the config file.
var RelativePath = cli.StringFlag{
Name: "relative-path",
Copy link
Member

Choose a reason for hiding this comment

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

s/relative-path/consensus-wallet?

With the current implementation it may be an absolute path, and it's OK. And the CLI flag should be more common, because when we start a node with some neo-go node -t --relative-path ./smth.json it's not very clear what's the purpose of this --relative-path, especially when we have --config-path and --config-file options.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I kept it to how Roman named it in #3179 (comment) but I agree that the current name isn't very descriptive.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I'm still not clear enough with this. "relative-path" should be added to any relative path in the config. You may have other wallets for other services for example. Or you may want to have a relative path for your DB. Overriding a single parameter is not very exciting.

Copy link
Member

Choose a reason for hiding this comment

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

And in that sense it'd be nice to add the same flag to cli/vm/vm.go that uses config files as well.

The result is that any non-absolute path in the config is relative-path + the_value_from_the_config. I think it'd be more powerful this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm going to be way too inefficient in figuring out where all those paths are and how they work so I think it's best to leave it up to you guys then.

@@ -73,6 +73,13 @@ var ConfigFile = cli.StringFlag{
Usage: "path to the node configuration file (overrides --config-path option)",
}

// RelativePath is a flag for commands that use node configuration and provides
// the path to the consensus wallet instead of reading it from the config file.
var RelativePath = cli.StringFlag{
Copy link
Member

Choose a reason for hiding this comment

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

s/RelativePath/ConsensusWalletPath?

Comment on lines 173 to 176
if err == nil && len(relativePath) != 0 {
cfg.ApplicationConfiguration.Consensus.UnlockWallet.Path = relativePath
}
return cfg, err
Copy link
Member

Choose a reason for hiding this comment

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

Move this part to the end of the function, it allows to avoid code duplication.

// the path to the consensus wallet instead of reading it from the config file.
var RelativePath = cli.StringFlag{
Name: "relative-path",
Usage: "path to the consensus wallet file (overrides path defined in the config)",
Copy link
Member

Choose a reason for hiding this comment

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

s/defined in the config/defined in the Consensus subsection of the node configuration file

@ixje
Copy link
Contributor Author

ixje commented Nov 13, 2023

I'm aware it should become a single commit in the end. I'll squash once I get the green light it all looks as intended

@ixje ixje closed this Nov 13, 2023
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.

UnlockWallet relative to config instead of node execution dir
3 participants