55 "os"
66 "path/filepath"
77
8+ "github.com/hyperledger/fabric-private-chaincode/tle_go/listener"
89 "github.com/hyperledger/fabric-private-chaincode/tle_go/tlecore"
10+ tleconfig "github.com/hyperledger/fabric-private-chaincode/tle_go/tlecore/config"
911)
1012
1113func readConfig () {
@@ -18,17 +20,30 @@ func readConfig() {
1820 } else {
1921 configPath = os .Getenv ("CORE_CONFIG_PATH" )
2022 }
21- tlecore .SetupConfig (configPath )
23+ tleconfig .SetupConfig (configPath )
2224}
2325
2426func main () {
25- fmt .Println ("--- in TLE_go main.go start to create grpc server.---" )
26- readConfig ()
27-
28- tlestate := & tlecore.Tlestate {}
2927
3028 // serve block listener.
31- go tlecore .ServePeer (tlestate )
29+ channelID := "testchannel"
30+ serverAddr := "host.docker.internal:20000"
31+ caCertPath := "/project/src/github.com/hyperledger/fabric-private-chaincode/samples/deployment/fabric-smart-client/the-simple-testing-network/testdata/fabric.default/crypto/ca-certs.pem"
32+ // if fpc_path exist, which mean it is running in local machine.
33+ fpcPath := os .Getenv ("FPC_PATH" )
34+ if fpcPath != "" {
35+ serverAddr = "127.0.0.1:20000"
36+ caCertPath = filepath .Join (fpcPath , "samples/deployment/fabric-smart-client/the-simple-testing-network/testdata/fabric.default/crypto/ca-certs.pem" )
37+ }
38+ blockListener := listener .NewOrdererBlockGetter (channelID , serverAddr , caCertPath )
39+ // blockListener := listener.NewFileBlockGetter()
40+ fmt .Scanln ()
41+
42+ // fmt.Println("--- in TLE_go main.go start to create grpc server.---")
43+
44+ readConfig ()
45+ tlestate := & tlecore.Tlestate {}
46+ go tlecore .ServePeer (tlestate , blockListener )
3247
3348 // serve metadata service.
3449 tlecore .ServeMeta ("0.0.0.0:50051" , tlestate )
0 commit comments