From 6f4a391d069f0ed54aa87e697a7024618ca18e1b Mon Sep 17 00:00:00 2001 From: Jason Yellick Date: Fri, 17 Feb 2017 11:22:30 -0500 Subject: [PATCH] [FAB-2336] Add application/MSP to genesis.yaml https://jira.hyperledger.org/browse/FAB-2336 The genesis.yaml file currently only contains the bootstrapping parameters necessary for the orderer (without MSPs). This CR adds the additional configuration variables needed for MSPs and the application side, and populates them into config structures. No one consumes them yet however. Change-Id: Ia40a14de9d90f6e06dd96a9b226a72712fbbea2b Signed-off-by: Jason Yellick --- common/configtx/tool/genesis.yaml | 52 ++++++++++++++++++++++ common/configtx/tool/localconfig/config.go | 39 +++++++++++++--- 2 files changed, 85 insertions(+), 6 deletions(-) diff --git a/common/configtx/tool/genesis.yaml b/common/configtx/tool/genesis.yaml index 1f627afdbe7..5111fd2a355 100644 --- a/common/configtx/tool/genesis.yaml +++ b/common/configtx/tool/genesis.yaml @@ -1,4 +1,33 @@ --- +################################################################################ +# +# Section: Organizations +# +# - This section defines the different organizational identities which will +# be referenced later in the configuration. +# +################################################################################ +Organizations: + + - &defaultOrg + # DefaultOrg defines the organization which is used in the sampleconfig + # of the fabric.git development environment + Name: defaultOrg + + # ID to load the MSP definition as + ID: DEFAULT + + # MSPDir is the filesystem path which contains the MSP configuration + MSPDir: msp/sampleconfig + + + AnchorPeers: + # AnchorPeers defines the location of peers which can be used + # for cross org gossip communication. Note, this value is only + # encoded in the genesis block in the Application section context + - Host: 127.0.0.1 + Port: 7051 + ################################################################################ # # SECTION: Orderer @@ -40,3 +69,26 @@ Orderer: Brokers: - 127.0.0.1:9092 + # Organizations is the list of orgs which are defined as participants on + # the orderer side of the network + Organizations: + + # The default organization as defined in the organization section + - *defaultOrg + +################################################################################ +# +# SECTION: Application +# +# - This section defines the values to encode into a config transaction or +# genesis block for application related parameters +# +################################################################################ +Application: + + # Organizations is the list of orgs which are defined as participants on + # the application side of the network + Organizations: + + # The default organization as defined in the organization section + - *defaultOrg diff --git a/common/configtx/tool/localconfig/config.go b/common/configtx/tool/localconfig/config.go index f4938695845..06cac4ad74b 100644 --- a/common/configtx/tool/localconfig/config.go +++ b/common/configtx/tool/localconfig/config.go @@ -40,16 +40,43 @@ const Prefix string = "CONFIGTX" // TopLevel contains the genesis structures for use by the provisional bootstrapper type TopLevel struct { - Orderer Orderer + Application Application + Organizations []*Organization + Orderer Orderer +} + +type Application struct { + Organizations []*Organization +} + +type Organization struct { + Name string + ID string + MSPDir string + + // Note, the viper deserialization does not seem to care for + // embedding of types, so we use one organization structure for + // both orderers and applications + AnchorPeers []*AnchorPeer +} + +type AnchorPeer struct { + Host string + Port int +} + +type ApplicationOrganization struct { + Organization } // Orderer contains config which is used for orderer genesis by the provisional bootstrapper type Orderer struct { - OrdererType string - Addresses []string - BatchTimeout time.Duration - BatchSize BatchSize - Kafka Kafka + OrdererType string + Addresses []string + BatchTimeout time.Duration + BatchSize BatchSize + Kafka Kafka + Organizations []*Organization } // BatchSize contains configuration affecting the size of batches