@Override public Config parse(final CommandLine commandLine) throws IOException { final ConfigFactory configFactory = ConfigFactory.create(); Config config = null; final boolean isGeneratingWithKeyVault = commandLine.hasOption("keygen") && commandLine.hasOption("keygenvaulturl"); if (commandLine.hasOption("configfile") && !isGeneratingWithKeyVault) { final Path path = Paths.get(commandLine.getOptionValue("configfile")); if (!Files.exists(path)) { throw new FileNotFoundException(String.format("%s not found.", path)); } try (InputStream in = Files.newInputStream(path)) { config = configFactory.create(in, newlyGeneratedKeys); } if (!newlyGeneratedKeys.isEmpty()) { //we have generated new keys, so we need to output the new configuration output(commandLine, config); } ConfigFileStore.create(path); } return config; }
@Override public Config parse(final CommandLine commandLine) throws IOException { final ConfigFactory configFactory = ConfigFactory.create(); Config config = null; final boolean isGeneratingWithKeyVault = commandLine.hasOption("keygen") && commandLine.hasOption("keygenvaulturl"); if (commandLine.hasOption("configfile") && !isGeneratingWithKeyVault) { final Path path = Paths.get(commandLine.getOptionValue("configfile")); if (!Files.exists(path)) { throw new FileNotFoundException(String.format("%s not found.", path)); } try (InputStream in = Files.newInputStream(path)) { config = configFactory.create(in, newlyGeneratedKeys); } if (!newlyGeneratedKeys.isEmpty()) { //we have generated new keys, so we need to output the new configuration output(commandLine, config); } ConfigFileStore.create(path); } return config; }