Documentation
¶
Overview ¶
Example: etcd provider.
Models the runtime config of a checkout service: log level, request timeout, a rate limit, a maintenance feature flag, a database connection struct, and a list of allowed CORS origins. etcd watches every key under "checkout/" with a single prefix watch, so updates arrive as events.
Run it end to end:
docker compose up -d
docker compose exec etcd etcdctl put checkout/log_level info
docker compose exec etcd etcdctl put checkout/request_timeout 30s
docker compose exec etcd etcdctl put checkout/rate_limit_rps 100
docker compose exec etcd etcdctl put checkout/maintenance_mode false
docker compose exec etcd etcdctl put checkout/database '{"host":"db.internal","port":5432,"max_open_conns":20}'
docker compose exec etcd etcdctl put checkout/allowed_origins '["https://app.example.com"]'
go run main.go
Then change a value and watch the app log the event:
docker compose exec etcd etcdctl put checkout/rate_limit_rps 500 docker compose exec etcd etcdctl put checkout/maintenance_mode true
Click to show internal directories.
Click to hide internal directories.