Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Client configuration example

Demonstrates the three idiomatic ways to construct a Dapr Client in Rust:

Constructor Use when
dapr::Client::new() Standard sidecar deployment — read everything from env vars.
dapr::Client::from_options(opts) You need explicit, programmatic configuration.
dapr::Client::connect_with_address(a) You only need to override the address.

Env vars honored

Variable Default
DAPR_GRPC_ENDPOINT (unset) — takes precedence
DAPR_GRPC_PORT 50001
DAPR_API_TOKEN (unset) — no auth header sent
DAPR_CLIENT_TIMEOUT_SECONDS 5

Run

  1. Build the examples:
cargo build --examples
  1. Run the example with dapr:
dapr run --app-id=rustapp --dapr-grpc-port 50001 -- cargo run --example client-config