Where can I find out the possible environment variables for Hyperledger Fabric peer command?

北慕城南 提交于 2019-12-03 08:19:10
Artem Barger

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 "_"

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!