mirror of https://github.com/status-im/consul.git
Merge branch 'master' into f-docker-check
This commit is contained in:
commit
24ed164b51
|
@ -17,13 +17,18 @@ Usage
|
||||||
Below is an example of using the Consul client:
|
Below is an example of using the Consul client:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// Get a new client, with KV endpoints
|
// Get a new client
|
||||||
client, _ := api.NewClient(api.DefaultConfig())
|
client, err := api.NewClient(api.DefaultConfig())
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get a handle to the KV API
|
||||||
kv := client.KV()
|
kv := client.KV()
|
||||||
|
|
||||||
// PUT a new KV pair
|
// PUT a new KV pair
|
||||||
p := &api.KVPair{Key: "foo", Value: []byte("test")}
|
p := &api.KVPair{Key: "foo", Value: []byte("test")}
|
||||||
_, err := kv.Put(p, nil)
|
_, err = kv.Put(p, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue