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?
e.g.
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 provides a configuration file called core.yaml, you can find that inside the peer container on folder /etc/hyperledger/fabric/
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()
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
any of these value could be overridden by exporting proper environmental variable, for instance peer network id:
export CORE_PEER_NETWORKID=mypeerID
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
To make msp component to log debug level message we need to export following variable:
export PEER_LOGGING_MSP=debug
Please note that this will take effect only if exported prior to peer start.
Hyperledger Fabric provides a sample configuration file that basically includes all the possible properties for the peer
component. Of course, you will need to convert the yaml properties to the corresponding environment variable name using the formula:
foo:
bar: baz
becomes CORE_FOO_BAR=baz
The same applies to the orderer
component, which has it's own sample configuration file.
environment are actually items in core.yaml,replace "." with "_"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With