Skip to content

Commit

Permalink
removed cli configs
Browse files Browse the repository at this point in the history
  • Loading branch information
vineshtk committed Oct 30, 2024
1 parent 1524f79 commit a9823b2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
Binary file added fabrix
Binary file not shown.
56 changes: 28 additions & 28 deletions pkg/configs/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,32 +303,32 @@ func CreateDockerComposeMembers(domainName string, orgPeers map[string]int, vers
}
info.Orderer.Peers = append(info.Orderer.Peers, ordererPeer)

// configs for CLI
custom_viper.Set("services:cli:container_name", "cli")
custom_viper.Set("services:cli:image",fmt.Sprintf("hyperledger/fabric-tools:%s", version) )
custom_viper.Set("services:cli:labels:service", "hyperledger-fabric")
custom_viper.Set("services:cli:tty", true)
custom_viper.Set("services:cli:stdin_open", true)

envSliceCLI := []string{
"GOPATH=/opt/gopath",
"FABRIC_LOGGING_SPEC=INFO",
"CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock",
}
custom_viper.Set("services:cli:environment", envSliceCLI)

custom_viper.Set("services:cli:working_dir", "/opt/gopath/src/github.com/hyperledger/fabric/peer")
custom_viper.Set("services:cli:command", "/bin/bash")

CLIVolumes := []string{
"/var/run/docker.sock:/host/var/run/docker.sock",
"../organizations:/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations",
}
custom_viper.Set("services:cli:volumes", CLIVolumes)
custom_viper.Set("services:cli:networks", networkSlice)

// CLI depends will be added from the for loop
CLIDepends := []string{}
// // configs for CLI
// custom_viper.Set("services:cli:container_name", "cli")
// custom_viper.Set("services:cli:image",fmt.Sprintf("hyperledger/fabric-tools:%s", version) )
// custom_viper.Set("services:cli:labels:service", "hyperledger-fabric")
// custom_viper.Set("services:cli:tty", true)
// custom_viper.Set("services:cli:stdin_open", true)

// envSliceCLI := []string{
// "GOPATH=/opt/gopath",
// "FABRIC_LOGGING_SPEC=INFO",
// "CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock",
// }
// custom_viper.Set("services:cli:environment", envSliceCLI)

// custom_viper.Set("services:cli:working_dir", "/opt/gopath/src/github.com/hyperledger/fabric/peer")
// custom_viper.Set("services:cli:command", "/bin/bash")

// CLIVolumes := []string{
// "/var/run/docker.sock:/host/var/run/docker.sock",
// "../organizations:/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations",
// }
// custom_viper.Set("services:cli:volumes", CLIVolumes)
// custom_viper.Set("services:cli:networks", networkSlice)

// // CLI depends will be added from the for loop
// CLIDepends := []string{}

// for creating port numbers dynamically as well keeping the peer count
i := 0
Expand Down Expand Up @@ -432,8 +432,8 @@ func CreateDockerComposeMembers(domainName string, orgPeers map[string]int, vers
custom_viper.Set(fmt.Sprintf("volumes:peer%v.%v.%v", peer, org, domainName), map[string]string{})

// adding peers to depends field of CLI - may be improved
CLIDepends = append(CLIDepends, fmt.Sprintf("peer%v.%v.%v", peer, org, domainName))
custom_viper.Set("services:cli:depends_on", CLIDepends)
// CLIDepends = append(CLIDepends, fmt.Sprintf("peer%v.%v.%v", peer, org, domainName))
// custom_viper.Set("services:cli:depends_on", CLIDepends)

if err := custom_viper.SafeWriteConfig(); err != nil {
if _, ok := err.(viper.ConfigFileAlreadyExistsError); ok {
Expand Down
4 changes: 2 additions & 2 deletions test.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export FABRIC_CFG_PATH=./peercfg
export CHANNEL_NAME=fabrixchannel
export CHANNEL_NAME=autochannel
export CORE_PEER_LOCALMSPID=ManufacturerMSP
export CORE_PEER_TLS_ENABLED=true
export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/manufacturer.auto.com/peers/peer0.manufacturer.auto.com/tls/ca.crt
Expand All @@ -13,4 +13,4 @@ export MVD_PEER_TLSROOTCERT=${PWD}/organizations/peerOrganizations/mvd.auto.com/

peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.auto.com --tls --cafile $ORDERER_CA -C $CHANNEL_NAME -n sample-chaincode --peerAddresses localhost:7071 --tlsRootCertFiles $MANUFACTURER_PEER_TLSROOTCERT --peerAddresses localhost:7051 --tlsRootCertFiles $DEALER_PEER_TLSROOTCERT --peerAddresses localhost:7091 --tlsRootCertFiles $MVD_PEER_TLSROOTCERT -c '{"function":"CreateCar","Args":["Car-11", "Tata", "Nexon", "White", "Factory-1", "22/07/2023"]}'

peer chaincode query -C fabrixchannel -n sample-chaincode -c '{"Args":["GetAllCars"]}'
peer chaincode query -C $CHANNEL_NAME -n sample-chaincode -c '{"Args":["GetAllCars"]}'

0 comments on commit a9823b2

Please sign in to comment.