github.com/muhammedhassanm/blockchain@v0.0.0-20200120143007-697261defd4d/Decentralized-Energy-Composer-master/fabric-dev-servers/fabric-scripts/hlfv1/createComposerProfile.sh (about)

     1  #!/bin/bash
     2  
     3  # Licensed under the Apache License, Version 2.0 (the "License");
     4  # you may not use this file except in compliance with the License.
     5  # You may obtain a copy of the License at
     6  # 
     7  # http://www.apache.org/licenses/LICENSE-2.0
     8  # 
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS,
    11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  # See the License for the specific language governing permissions and
    13  # limitations under the License.
    14  
    15  # Exit on first error, print all commands.
    16  set -ev
    17  # Grab the current directory
    18  DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
    19  
    20  rm -rf ~/.composer-connection-profiles/hlfv1/*
    21  rm -rf ~/.composer-credentials/*
    22  
    23  # copy org admin credentials into the keyValStore
    24  mkdir -p ~/.composer-credentials
    25  cp "${DIR}"/composer/creds/* ~/.composer-credentials
    26  
    27  # create a composer connection profile
    28  mkdir -p ~/.composer-connection-profiles/hlfv1
    29  cat << EOF > ~/.composer-connection-profiles/hlfv1/connection.json
    30  {
    31      "type": "hlfv1",
    32      "orderers": [
    33         { "url" : "grpc://localhost:7050" }
    34      ],
    35      "ca": { "url": "http://localhost:7054", 
    36              "name": "ca.org1.example.com"
    37      },
    38      "peers": [
    39          {
    40              "requestURL": "grpc://localhost:7051",
    41              "eventURL": "grpc://localhost:7053"
    42          }
    43      ],
    44      "keyValStore": "${HOME}/.composer-credentials",
    45      "channel": "composerchannel",
    46      "mspID": "Org1MSP",
    47      "timeout": "300"
    48  }
    49  EOF
    50  echo "Hyperledger Composer profile has been created for the Hyperledger Fabric v1.0 instance"