consul-kv
consul-kv copied to clipboard
Golang K/V client for Consul
consul-kv
DEPRECATED Please use consul api package instead. Godocs for that package are here.
This package provides the consulkv
package which is a Key/Value
client for Consul. It supports all the commands as of Consul 0.1,
and has a very simple API.
Documentation
The full documentation is available on Godoc
Usage
Below is an example of using the Consul KV client:
client, _ := consulkv.NewClient(consulkv.DefaultConfig())
key := "foo"
value := []byte("test")
client.Put(key, value, 42)
meta, pair, err := client.Get(key)
fmt.Printf("Got %s (%d): %s", pair.Key, pair.Flags, pair.Value)
Development
To run the tests, first run a consul server with API port 8500:
consul agent -data-dir /tmp/consul -server -bootstrap
The run tests:
go test