Update README.md (#370)

Update gRPC invoke instructions.
This commit is contained in:
Yaron Schneider 2020-02-25 19:03:53 -08:00 committed by GitHub
parent 1fa6bc30c0
commit d0448ac7b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 0 deletions

View File

@ -66,6 +66,8 @@ import (
2. Create the client
If mTLS is disabled:
```go
// Get the Dapr port and create a connection
daprPort := os.Getenv("DAPR_GRPC_PORT")
@ -80,6 +82,25 @@ import (
client := pb.NewDaprClient(conn)
```
If mTLS is enabled:
```go
tlsConfig := &tls.Config{
InsecureSkipVerify: true,
}
creds := credentials.NewTLS(tlsConfig)
conn, err := grpc.Dial(daprAddress, grpc.WithTransportCredentials(creds))
if err != nil {
fmt.Println(err)
}
defer conn.Close()
// Create the client
client := pb.NewDaprClient(conn)
```
3. Invoke the Save State method
```go