Fabric 2.2 测试网络 enVar.sh 详解

#!/bin/bash
#
# Copyright IBM Corp All Rights Reserved
#
# SPDX-License-Identifier: Apache-2.0
#

# This is a collection of bash functions used by different scripts

# imports
. scripts/utils.sh

export CORE_PEER_TLS_ENABLED=true
export ORDERER_CA=${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
export PEER0_ORG1_CA=${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
export PEER0_ORG2_CA=${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
export PEER0_ORG3_CA=${PWD}/organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt

enVar.sh 是一个由不同脚本使用的Bash函数集合。脚本中的主要变量被设置为默认值,并导入了utils.sh脚本中的其他函数。其中包括设置CORE_PEER_TLS_ENABLED和ORDERER_CA环境变量的默认值,以及设置每个组织的PEER0_CA证书的默认值。这些变量和函数可以帮助在不同的脚本中操作Hyperledger Fabric网络。 

# Set environment variables for the peer org
setGlobals() {

这是一个用来设置 peer 节点环境变量的函数,根据传入的参数 $1 来确定要使用的组织的 ID,然后设置相应的环境变量,包括本地 MSP ID、TLS 根证书文件路径、MSP 配置文件路径、节点地址等。在函数最后,如果 VERBOSE 环境变量被设置为 true,则输出所有与 CORE 相关的环境变量。 

  local USING_ORG=""

 local是一个关键字,用于声明一个局部变量。这里声明了一个名为USING_ORG的局部变量,并将其赋值为空字符串。local关键字使变量的作用域仅限于当前函数中,这意味着其他函数不能访问该变量。

  if [ -z "$OVERRIDE_ORG" ]; 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值