Skip to content
Golang K/V client for Consul
Branch: master
Clone or download
Latest commit 044c7ba Jan 31, 2015
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial commit Apr 26, 2014
LICENSE Initial commit Apr 26, 2014
README.md Update the new API path Jan 30, 2015
client.go Ensure path is backwards compatible with old behavior Jul 1, 2014
client_test.go lint fix - error msgs start with lower case May 15, 2014

README.md

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
You can’t perform that action at this time.