Skip to content

Commit

Permalink
completed configtx
Browse files Browse the repository at this point in the history
  • Loading branch information
vineshtk committed Mar 26, 2024
1 parent ba92a49 commit 9e4115a
Showing 1 changed file with 10 additions and 26 deletions.
36 changes: 10 additions & 26 deletions pkg/configs/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,38 +472,22 @@ func CreateConfigTx(domainName string, orgPeers map[string]int) {
}
viper.Set("Channel", channelDefaults)

profiles := map[string]map[string]interface{}{
"ThreeOrgsChannel": {"<<":channelDefaults},
"orderer":{"<<":orderDefaults},

type Consenters struct {
Host string `yaml:"Host"`
Port string `yaml:"Port"`
ClientTLSCert string `yaml:"ClientTLSCert"`
ServerTLSCert string `yaml:"ServerTLSCert"`
}

consenters := []Consenters{{Host: fmt.Sprintf("orderer.%v", domainName), Port: "7050", ClientTLSCert: fmt.Sprintf("../organizations/ordererOrganizations/%v/orderers/orderer.%v/tls/server.crt", domainName,domainName) , ServerTLSCert: fmt.Sprintf("../organizations/ordererOrganizations/%v/orderers/orderer.%v/tls/server.crt", domainName,domainName)},}

profiles := map[string]map[string]interface{}{
"ThreeOrgsChannel": {"<<": channelDefaults, "orderer": map[string]interface{}{"<<": orderDefaults, "OrdererType": "etcdraft", "EtcdRaft":map[string]interface{}{"Consenters":consenters} , "Organizations":ordererOrg,"Capabilities":Capabilities["Orderer"]},"Application": map[string]interface{}{"<<":applicationDefaults,"Organizations":orgs[1:], "Capabilities": Capabilities["Application"]},
}}

// set profile config
viper.Set("Profiles", profiles)

// <<: *ChannelDefaults
// Orderer:
// <<: *OrdererDefaults
// OrdererType: etcdraft
// EtcdRaft:
// Consenters:
// - Host: orderer.auto.com
// Port: 7050
// ClientTLSCert: ../organizations/ordererOrganizations/auto.com/orderers/orderer.auto.com/tls/server.crt
// ServerTLSCert: ../organizations/ordererOrganizations/auto.com/orderers/orderer.auto.com/tls/server.crt
// Organizations:
// - *OrdererOrg
// Capabilities: *OrdererCapabilities
// Application:
// <<: *ApplicationDefaults
// Organizations:
// - *Manufacturer
// - *Dealer
// - *Mvd

// Capabilities: *ApplicationCapabilities

err := viper.SafeWriteConfig()
if err != nil {
if _, ok := err.(viper.ConfigFileAlreadyExistsError); ok {
Expand Down

0 comments on commit 9e4115a

Please sign in to comment.