在哪里可以找到Hyperledger Fabric对等命令的可能环境变量? [英] Where can I find out the possible environment variables for Hyperledger Fabric peer command?
问题描述
在配置要运行的对等节点时,示例docker-compose文件中包含许多环境变量.我可以找到所有记录在案的地方吗?
When configuring a peer node to run, there are a number of environment variables included in the sample docker-compose files. Is there somewhere that I can find them all documented?
例如
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_ID=peer0.org1.example.com
- CORE_LOGGING_PEER=debug
- CORE_CHAINCODE_LOGGING_LEVEL=DEBUG
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
推荐答案
Hyperledger Fabric提供了一个名为 core.yaml 的配置文件,您可以在对等容器中找到在/etc/hyperledger/fabric/
Hyperledger Fabric provides a configuration file called core.yaml, you can find that inside the peer container on folder /etc/hyperledger/fabric/
Fabric使用 Viper 作为配置框架,该框架提供了按环境覆盖配置文件值的功能变量.基本上,它初始化如下:
Fabric uses Viper as configuration framework, which provides an ability to override values of configuration files by environmental variables. Basically it initialized as following:
// used to prefix config keys to prevent possible collisions
viper.SetEnvPrefix("core")
// enforces to check values configured via environmental variables first
viper.AutomaticEnv()
这使得毒蛇可以在以CORE
字符串为前缀的环境变量中寻找所有配置密钥.
This makes viper to seek for all configuration key among environmental variables prefixed by CORE
string.
现在,例如,如果我们看一下样本配置中的对等部分(已更新):
Now if for example we take a look on peer section (updated) within sample config:
peer:
id: jdoe
networkId: dev
listenAddress: 0.0.0.0:7051
address: 0.0.0.0:7051
可以通过导出适当的环境变量来覆盖这些值中的任何一个,例如对等网络ID:
any of these value could be overridden by exporting proper environmental variable, for instance peer network id:
export CORE_PEER_NETWORKID=mypeerID
Same也适用于其他部分,例如,如果我们想控制不同组件的日志记录级别:
Same also works for other sections, for example if we would like to control logging level of different components:
logging:
peer: info
cauthdsl: warning
gossip: warning
ledger: info
msp: warning
policies: warning
grpc: error
要使msp组件记录调试级别消息,我们需要导出以下变量:
To make msp component to log debug level message we need to export following variable:
export PEER_LOGGING_MSP=debug
请注意,只有在对等启动之前将其导出,此选项才会生效.
这篇关于在哪里可以找到Hyperledger Fabric对等命令的可能环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!