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

前端 未结 3 1165
小蘑菇
小蘑菇 2021-02-06 11:51

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 documen

相关标签:
3条回答
  • 2021-02-06 11:54

    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.

    0 讨论(0)
  • 2021-02-06 11:59

    environment are actually items in core.yaml,replace "." with "_"

    0 讨论(0)
  • 2021-02-06 12:10

    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.

    0 讨论(0)
提交回复
热议问题