public void setupClient()

in src/main/java/com/lambdajavablockchain/service/ManagedBlockchainService.java [44:68]


    public void setupClient() throws AppException, ManagedBlockchainServiceException {
        if(this.caClient != null && this.client != null) {
            return;
        }
        try {
            log.info("Setting up CA Client and Client");
            // Set CA details
            this.ambTlsCertAsString = SecretsManagerUtil.readCert(AMBConfig.AMB_CERT_PATH);
            Properties caProperties = new Properties();
            caProperties.put("pemBytes", ambTlsCertAsString.getBytes());

            // create HLF CA Client
            this.caClient = createHFCAClient(caProperties);

            // create HLF Client
            this.client = createHFClient();
        } catch (AppException e) {
            log.error("Error setting up client, ManagedBlockchainService.setupClient() failed - " + e.getMessage());
            e.printStackTrace();
            throw new ManagedBlockchainServiceException("Error setting up client - " + e.getMessage(), e);
        } catch (IOException e) {
            log.error("Could not find Managed Blockchain TLS certificate - " + e.getMessage());
            throw new AppException("Managed Blockchain TLS certificate not found", e);
        }
    }