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

Parameterize the wallet file location #580

Merged
merged 2 commits into from
Apr 21, 2023

Conversation

andozw
Copy link
Collaborator

@andozw andozw commented Apr 7, 2023

Allows for setting custom wallet file locations and running multiple instances in the same environment.

Allows for setting custom wallet file locations and running multiple
instances in the same environment.
ivmaykov
ivmaykov previously approved these changes Apr 7, 2023
Copy link
Contributor

@ivmaykov ivmaykov left a comment

Choose a reason for hiding this comment

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

Approving with some nits, please fix them before merging.

@@ -54,6 +55,9 @@ public class SubzeroGui {
// Almost always you want to talk to subzero on localhost
@Parameter(names = "--hostname") public String hostname = "localhost";

// Wallet file location
@Parameter(names = "--wallet-file") public String walletFilePath = "/data/app/subzero/wallets/";
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I think this should be called --wallet-dir or similar since it's actually the path to the wallet directory

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: and similarly call the variable walletDirectory or something like that, since it's neither a Path object (it's a String), nor names the wallet file.

* Will throw runtime exceptions if the path provided is invalid.
*/
public WalletLoader(String walletFilePath) {
directory = FileSystems.getDefault().getPath(walletFilePath);
Copy link
Contributor

Choose a reason for hiding this comment

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

super nit: this can call the other constructor instead: this(FileSystems ...), this way if the Path constructor gets more logic later we don't need to duplicate it here.

Comment on lines 109 to 114
@Test
public void walletLoaderBadFilePaths() throws Exception {
assertThatThrownBy(() -> new WalletLoader("\0"))
.isInstanceOf(IllegalArgumentException.class);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

super nit: should we also add the following test cases?

  • path looks well-formed but doesn't exist
  • path refers to a regular file rather than a directory

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i didn't include these because they get handled by the marker file check, but it doesn't hurt to have the tests explicitly in case something changes later.

oreparaz
oreparaz previously approved these changes Apr 7, 2023
Copy link
Collaborator

@oreparaz oreparaz left a comment

Choose a reason for hiding this comment

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

LGTM concept ack

@andozw andozw dismissed stale reviews from oreparaz and ivmaykov via 206da85 April 21, 2023 21:34
Copy link
Contributor

@ivmaykov ivmaykov left a comment

Choose a reason for hiding this comment

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

LGTM

@andozw andozw merged commit 68233f1 into square:master Apr 21, 2023
@andozw andozw deleted the seana.20230405.wallet-file-config branch April 21, 2023 22:14
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.

3 participants