From 7b7fc09804db0127c3c17d318dbc85470be82e17 Mon Sep 17 00:00:00 2001 From: luomin Date: Mon, 26 Feb 2018 19:31:00 +0900 Subject: [PATCH] [FAB-8496] allow modification of affiliations As pointed out in [FAB-8496], updating the orgs for the fabric-ca sample does not have an effect currently. This RC added the affiliation settings in env.sh script into the default config file. Change-Id: I3eaa601fc572f6880b15dec48a4be8a69d01eb4e Signed-off-by: Min Luo --- fabric-ca/makeDocker.sh | 2 ++ fabric-ca/scripts/start-intermediate-ca.sh | 8 ++++++++ fabric-ca/scripts/start-root-ca.sh | 8 ++++++++ 3 files changed, 18 insertions(+) diff --git a/fabric-ca/makeDocker.sh b/fabric-ca/makeDocker.sh index 4ca3e946d3..f55bbba416 100755 --- a/fabric-ca/makeDocker.sh +++ b/fabric-ca/makeDocker.sh @@ -133,6 +133,7 @@ function writeRootCA { - FABRIC_CA_SERVER_DEBUG=true - BOOTSTRAP_USER_PASS=$ROOT_CA_ADMIN_USER_PASS - TARGET_CERTFILE=$ROOT_CA_CERTFILE + - FABRIC_ORGS="$ORGS" volumes: - ./scripts:/scripts - ./$DATA:/$DATA @@ -157,6 +158,7 @@ function writeIntermediateCA { - PARENT_URL=https://$ROOT_CA_ADMIN_USER_PASS@$ROOT_CA_HOST:7054 - TARGET_CHAINFILE=$INT_CA_CHAINFILE - ORG=$ORG + - FABRIC_ORGS="$ORGS" volumes: - ./scripts:/scripts - ./$DATA:/$DATA diff --git a/fabric-ca/scripts/start-intermediate-ca.sh b/fabric-ca/scripts/start-intermediate-ca.sh index 9aaff554c1..01bf14b931 100755 --- a/fabric-ca/scripts/start-intermediate-ca.sh +++ b/fabric-ca/scripts/start-intermediate-ca.sh @@ -19,5 +19,13 @@ fabric-ca-server init -b $BOOTSTRAP_USER_PASS -u $PARENT_URL # Copy the intermediate CA's certificate chain to the data directory to be used by others cp $FABRIC_CA_SERVER_HOME/ca-chain.pem $TARGET_CHAINFILE +# Add the custom orgs +for o in $FABRIC_ORGS; do + aff=$aff"\n $o: []" +done +aff="${aff#\\n }" +sed -i "/affiliations:/a \\ $aff" \ + $FABRIC_CA_SERVER_HOME/fabric-ca-server-config.yaml + # Start the intermediate CA fabric-ca-server start diff --git a/fabric-ca/scripts/start-root-ca.sh b/fabric-ca/scripts/start-root-ca.sh index 27874ddf60..f1fa244b1a 100755 --- a/fabric-ca/scripts/start-root-ca.sh +++ b/fabric-ca/scripts/start-root-ca.sh @@ -13,5 +13,13 @@ fabric-ca-server init -b $BOOTSTRAP_USER_PASS # Copy the root CA's signing certificate to the data directory to be used by others cp $FABRIC_CA_SERVER_HOME/ca-cert.pem $TARGET_CERTFILE +# Add the custom orgs +for o in $FABRIC_ORGS; do + aff=$aff"\n $o: []" +done +aff="${aff#\\n }" +sed -i "/affiliations:/a \\ $aff" \ + $FABRIC_CA_SERVER_HOME/fabric-ca-server-config.yaml + # Start the root CA fabric-ca-server start