Renaming authentication config file cli command (#865)

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
Lucas Saldanha 6 years ago committed by GitHub
parent 556877209e
commit c0291635d0
  1. 12
      pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java
  2. 8
      pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java
  3. 2
      pantheon/src/test/resources/everything_config.toml

@ -463,10 +463,10 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
private final Boolean permissionsAccountsEnabled = false; private final Boolean permissionsAccountsEnabled = false;
@Option( @Option(
names = {"--permissions-config-path"}, names = {"--permissions-config-file"},
description = description =
"Path to permissions config TOML file (default: a file named \"permissions_config.toml\" in the Pantheon data folder)") "Path to permissions config TOML file (default: a file named \"permissions_config.toml\" in the Pantheon data folder)")
private String permissionsConfigPath = null; private String permissionsConfigFile = null;
@Option( @Option(
names = {"--privacy-enabled"}, names = {"--privacy-enabled"},
@ -638,10 +638,10 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
} }
} }
private String getPermissionsConfigPath() { private String getPermissionsConfigFile() {
return permissionsConfigPath != null return permissionsConfigFile != null
? permissionsConfigPath ? permissionsConfigFile
: dataDir().toAbsolutePath() : dataDir().toAbsolutePath()
+ System.getProperty("file.separator") + System.getProperty("file.separator")
+ DefaultCommandValues.PERMISSIONING_CONFIG_LOCATION; + DefaultCommandValues.PERMISSIONING_CONFIG_LOCATION;
@ -763,7 +763,7 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
final PermissioningConfiguration permissioningConfiguration = final PermissioningConfiguration permissioningConfiguration =
PermissioningConfigurationBuilder.permissioningConfigurationFromToml( PermissioningConfigurationBuilder.permissioningConfigurationFromToml(
getPermissionsConfigPath(), permissionsNodesEnabled, permissionsAccountsEnabled); getPermissionsConfigFile(), permissionsNodesEnabled, permissionsAccountsEnabled);
return Optional.of(permissioningConfiguration); return Optional.of(permissioningConfiguration);
} }

@ -316,19 +316,19 @@ public class PantheonCommandTest extends CommandTestAbstract {
@Test @Test
public void permissionsTomlPathWithoutOptionMustDisplayUsage() { public void permissionsTomlPathWithoutOptionMustDisplayUsage() {
parseCommand("--permissions-config-path"); parseCommand("--permissions-config-file");
verifyZeroInteractions(mockRunnerBuilder); verifyZeroInteractions(mockRunnerBuilder);
assertThat(commandErrorOutput.toString()) assertThat(commandErrorOutput.toString())
.startsWith("Missing required parameter for option '--permissions-config-path'"); .startsWith("Missing required parameter for option '--permissions-config-file'");
assertThat(commandOutput.toString()).isEmpty(); assertThat(commandOutput.toString()).isEmpty();
} }
@Test @Test
public void permissionsEnabledWithNonexistentConfigFileMustError() { public void permissionsEnabledWithNonexistentConfigFileMustError() {
parseCommand( parseCommand(
"--permissions-accounts-enabled", "--permissions-config-path", "file-does-not-exist"); "--permissions-accounts-enabled", "--permissions-config-file", "file-does-not-exist");
verifyZeroInteractions(mockRunnerBuilder); verifyZeroInteractions(mockRunnerBuilder);
@ -344,7 +344,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
Files.write(permToml, Resources.toByteArray(configFile)); Files.write(permToml, Resources.toByteArray(configFile));
parseCommand( parseCommand(
"--permissions-accounts-enabled", "--permissions-config-path", permToml.toString()); "--permissions-accounts-enabled", "--permissions-config-file", permToml.toString());
PermissioningConfiguration permissioningConfiguration = PermissioningConfiguration permissioningConfiguration =
PermissioningConfiguration.createDefault(); PermissioningConfiguration.createDefault();
permissioningConfiguration.setConfigurationFilePath(permToml.toString()); permissioningConfiguration.setConfigurationFilePath(permToml.toString());

@ -73,7 +73,7 @@ min-gas-price="1"
# Permissioning # Permissioning
permissions-nodes-enabled=false permissions-nodes-enabled=false
permissions-accounts-enabled=false permissions-accounts-enabled=false
permissions-config-path="./permissions_config.toml" permissions-config-file="./permissions_config.toml"
# Privacy # Privacy
privacy-url="http://127.0.0.1:8888" privacy-url="http://127.0.0.1:8888"

Loading…
Cancel
Save