fabric-samples/test-network-nano-bash/org2ca.sh
Dave Enyeart 0126ca518e
Update CA server bin path in test-network-nano-bash (#1299)
test-network-nano-bash is often used with locally built
fabric and fabric-ca binaries.
As such the intent is to first look for locally
built binaries and then fall back to binaries downloaded
with the samples.
This was correct for fabric binaries but not the fabric-ca binaries.

Signed-off-by: David Enyeart <enyeart@us.ibm.com>
2025-02-12 11:10:10 +00:00

39 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env sh
#
# SPDX-License-Identifier: Apache-2.0
#
export PATH="${PWD}"/../../fabric-ca/bin:"${PWD}"/../bin:"${PATH}"
export FABRIC_CFG_PATH="${PWD}"/../config
#Configure the CA_NAME, CA_PORT, OPERATIONS_PORT and CSR_HOSTS for the CA
export CA_NAME=org2ca
export CA_PORT=5054
export OPERATIONS_PORT=9845
export CSR_HOSTS=org2ca,localhost,127.0.0.1
export CA_DIRECTORY="${PWD}"/data_ca/"${CA_NAME}"
export CA_HOME="${CA_DIRECTORY}"/ca
export TLSCA_HOME="${CA_DIRECTORY}"/tlsca
export DB_HOME="${CA_DIRECTORY}"/db
export TEMPLATE_DIR="${PWD}"/ca/ca_config
# Check to see if the CA directory exists
if [ ! -d "${CA_DIRECTORY}" ]; then
# Create the new CA directory
mkdir -p "${CA_HOME}"
mkdir -p "${TLSCA_HOME}"
mkdir -p "${DB_HOME}"
# Copy the CA template files
cp "${TEMPLATE_DIR}"/ca/fabric-ca-server-config.yaml "${CA_HOME}"/fabric-ca-server-config.yaml
cp "${TEMPLATE_DIR}"/tlsca/fabric-ca-server-config.yaml "${TLSCA_HOME}"/fabric-ca-server-config.yaml
fi
export FABRIC_CA_SERVER_TLS_ENABLED=true
export FABRIC_CA_SERVER_CSR_CN="${CA_NAME}"
export FABRIC_CA_SERVER_CSR_HOSTS="${CSR_HOSTS}"
export FABRIC_CA_SERVER_DEBUG=true
export FABRIC_CA_SERVER_OPERATIONS_LISTENADDRESS=localhost:"${OPERATIONS_PORT}"
fabric-ca-server start -d -b admin:adminpw --port "${CA_PORT}" --home "${CA_HOME}"