com.quorum.tessera.cli.parsers.ConfigConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cli-api Show documentation
Show all versions of cli-api Show documentation
Tessera is a stateless Java system that is used to enable the encryption, decryption, and distribution of private transactions for Quorum.
package com.quorum.tessera.cli.parsers;
import com.quorum.tessera.config.Config;
import com.quorum.tessera.config.ConfigFactory;
import com.quorum.tessera.config.util.ConfigFileStore;
import picocli.CommandLine;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
public class ConfigConverter implements CommandLine.ITypeConverter {
@Override
public Config convert(final String value) throws Exception {
final ConfigFactory configFactory = ConfigFactory.create();
final Path path = Paths.get(value);
if (!Files.exists(path)) {
throw new FileNotFoundException(String.format("%s not found.", path));
}
ConfigFileStore.create(path);
try (InputStream in = Files.newInputStream(path)) {
return configFactory.create(in);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy