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

     1  # Licensed under the Apache License, Version 2.0 (the "License");
     2  # you may not use this file except in compliance with the License.
     3  # You may obtain a copy of the License at
     4  # 
     5  # http://www.apache.org/licenses/LICENSE-2.0
     6  # 
     7  # Unless required by applicable law or agreed to in writing, software
     8  # distributed under the License is distributed on an "AS IS" BASIS,
     9  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    10  # See the License for the specific language governing permissions and
    11  # limitations under the License.
    12  
    13  echo "Development only script for Hyperledger Fabric control"
    14  
    15  
    16  # Grab the current directory
    17  DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
    18  THIS_SCRIPT=`basename "$0"`
    19  echo "Running '${THIS_SCRIPT}'"
    20  
    21  if [ "${HL_FABRIC_VERSION}" ]; then
    22    export FABRIC_VERSION="${HL_FABRIC_VERSION}"
    23  fi
    24  
    25  if [ "${HL_FABRIC_START_TIMEOUT}" ]; then
    26    export FABRIC_START_TIMEOUT="${HL_FABRIC_START_TIMEOUT}"
    27  fi
    28  
    29  if [ -z ${FABRIC_VERSION+x} ]; then
    30   echo "FABRIC_VERSION is unset, assuming hlfv12"
    31   export FABRIC_VERSION="hlfv12"
    32  else
    33   echo "FABRIC_VERSION is set to '$FABRIC_VERSION'"
    34  fi
    35  
    36  
    37  if [ -z ${FABRIC_START_TIMEOUT+x} ]; then
    38   echo "FABRIC_START_TIMEOUT is unset, assuming 15 (seconds)"
    39   export FABRIC_START_TIMEOUT=15
    40  else
    41  
    42     re='^[0-9]+$'
    43     if ! [[ $FABRIC_START_TIMEOUT =~ $re ]] ; then
    44        echo "FABRIC_START_TIMEOUT: Not a number" >&2; exit 1
    45     fi
    46  
    47   echo "FABRIC_START_TIMEOUT is set to '$FABRIC_START_TIMEOUT'"
    48  fi
    49  
    50  "${DIR}"/fabric-scripts/"${FABRIC_VERSION}"/"${THIS_SCRIPT}" "$@"