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

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.