go-sdk/examples/configuration
Josh van Leeuwen cefbadb3d1
Update github.com/dapr/dapr to v1.13.0-rc.1 (#503)
* Update github.com/dapr/dapr to v1.13.0-rc.1

Signed-off-by: joshvanl <me@joshvanl.dev>

* Revert go.mod to use Go 1.20 as minimum version

Signed-off-by: joshvanl <me@joshvanl.dev>

* github actions: only perform go mod diff on same go version

Signed-off-by: joshvanl <me@joshvanl.dev>

---------

Signed-off-by: joshvanl <me@joshvanl.dev>
2024-02-07 07:54:01 -08:00
..
config fix: config api (#200) 2022-04-05 17:43:32 -07:00
README.md perf: enhanced configuration example (#483) 2023-12-28 10:19:04 +08:00
go.mod Update github.com/dapr/dapr to v1.13.0-rc.1 (#503) 2024-02-07 07:54:01 -08:00
go.sum Update github.com/dapr/dapr to v1.13.0-rc.1 (#503) 2024-02-07 07:54:01 -08:00
main.go perf: enhanced configuration example (#483) 2023-12-28 10:19:04 +08:00

README.md

Dapr Configuration Example

Step

Prepare

  • Dapr installed

Run Get Configuration

dapr run --app-id configuration-api\
         --app-protocol grpc \
         --app-port 5005 \
         --dapr-http-port 3006 \
         --log-level debug \
         --resources-path ./config/ \
         go run ./main.go

Result

  • Configuration Client Logs

The subscription event order may out of order.

got config key = mykey, value = myConfigValue

got config key = mySubscribeKey1, value = mySubscribeValue1 
got config key = mySubscribeKey2, value = mySubscribeValue1 
got config key = mySubscribeKey3, value = mySubscribeValue1 
got config key = mySubscribeKey1, value = mySubscribeValue2 
got config key = mySubscribeKey2, value = mySubscribeValue2 
got config key = mySubscribeKey3, value = mySubscribeValue2 
got config key = mySubscribeKey1, value = mySubscribeValue3 
got config key = mySubscribeKey2, value = mySubscribeValue3 
got config key = mySubscribeKey3, value = mySubscribeValue3 
got config key = mySubscribeKey1, value = mySubscribeValue4 
got config key = mySubscribeKey2, value = mySubscribeValue4 
got config key = mySubscribeKey3, value = mySubscribeValue4 
got config key = mySubscribeKey1, value = mySubscribeValue5 
got config key = mySubscribeKey2, value = mySubscribeValue5 
got config key = mySubscribeKey3, value = mySubscribeValue5 
dapr configuration subscribe finished.
dapr configuration unsubscribed
✅  Exited App successfully