# README
Consul loader
Loads config from consul KV.
Usage
Basic usage loading keys and using result as string with watcher
etcdLoader := klconsul.New(&klconsul.Config{
Client: consulClient, // from github.com/hashicorp/consul/api package
Keys: []Key{
{
Key: "foo",
},
},
Watch: true,
})
Loading keys and JSON parser
consulLoader := klconsul.New(&klconsul.Config{
Client: consulClient, // from github.com/hashicorp/consul/api package
Keys: []Key{
{
Key: "foo",
Parser: kpjson.Parser,
},
},
Watch: true,
})
Strict mode
If strict mode is enabled, a key defined in the config but missing in consul will trigger an error.
# Functions
New returns a new loader with the given config.
# Interfaces
ConsulKV is an interface that consul client.KV implements.