Skip to content

Latest commit

 

History

History
35 lines (30 loc) · 664 Bytes

README.md

File metadata and controls

35 lines (30 loc) · 664 Bytes

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.