10

I see a lot of examples for Hyperledger Fabric where I don't find core.yaml file in all examples. I see a lot of other files. And at many places, core.yaml is referred. Is there any other file, that corresponds to it? From where this, core.yaml config is picked? How should I use it?

Raj Wadhwa
  • 335
  • 2
  • 13
  • I think we'll need a little more detail here. First, "I don't find core.yaml file in all examples", what do you mean by "examples"? Do you mean fabric-samples? If not, where are you finding these examples? – ajp Sep 08 '17 at 20:20
  • @ajp Yes, I was referring to fabric-samples. – Raj Wadhwa Sep 11 '17 at 08:10

2 Answers2

7

core.yaml file provides basic configuration option for various peer modules. For example it is capable of configuring logging level, e.g.:

###############################################################################
logging:

    cauthdsl:   warning
    gossip:     warning
    ledger:     info
    msp:        warning
    policies:   warning
    grpc:       error

Now, the reason you do not see this file within fabric-sample, because it has been already packed into peer docker container and therefore simple a part of it. Next, since Hyperledger Fabric uses viper to read the configuration and viper initialed with:

// For environment variables.
viper.SetEnvPrefix("core")
viper.AutomaticEnv()
replacer := strings.NewReplacer(".", "_")
viper.SetEnvKeyReplacer(replacer)

Which make it possible to override and control configuration parameters by exporting them via environment variables prefixed with CORE.

Artem Barger
  • 40,769
  • 9
  • 59
  • 81
  • Thank You for replying. Okay. I got the point. So, Let's say if I provide the value of any parameter via environment variable, and start the peers, then If I go inside the docker image, then also, I won't see the value I provided via variable. It will still hold the value actually present in packed core.yaml. Am I correct? – Raj Wadhwa Sep 11 '17 at 08:14
  • Not really, actually if you have updated environment variable, once entering the container you will see updated value. However core.yaml will contain default or original value. – Artem Barger Sep 11 '17 at 08:27
  • You can try it with build your first network example – Artem Barger Sep 11 '17 at 08:29
  • Yes, I tried it. So, container does have it. Thank You ! Thumbs up ! – Raj Wadhwa Sep 11 '17 at 08:31
  • More info here https://hyperledger-fabric.readthedocs.io/en/release-1.1/commands/peernode.html – sean Jun 23 '18 at 21:51
1

core.yaml corresponds to a older version of Hyperledger Fabric, to the version 0.6. There, you defined the Peer configuration.

In the v1.0 Hyperledger Fabric, the docker-compose-file.yaml seem to be the same.

Urko
  • 1,479
  • 1
  • 14
  • 20
  • If this is true, as of v1.1.0-alpha the Peer package main() function seems to still try to find the core.yaml file: `const cmdRoot = "core"`, `err := common.InitConfig(cmdRoot)`, and `var mspMgrConfigDir = config.GetPath("peer.mspConfigPath")`, along with some others... – sean Jun 23 '18 at 21:47
  • But @Urko, you are correct that the docker-compose file can be used to override the core.yaml setup. – sean Jun 23 '18 at 21:52