consul

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Path of the key to read. If Recurse is true, this is treated
	// as a prefix.
	Key string

	// https://www.consul.io/api-docs/kv#read-key
	// If recurse is true, Consul returns an array of keys.
	// It specifies if the lookup should be recursive and treat
	// Key as a prefix instead of a literal match.
	// This is analogous to: consul kv get -recurse key
	Recurse bool

	// Gets additional metadata about the key in addition to the value such
	// as the ModifyIndex and any flags that may have been set on the key.
	// This is analogous to: consul kv get -detailed key
	Detailed bool

	// Consul client config
	Cfg *api.Config
}

Config represents the Consul client configuration.

type Consul

type Consul struct {
	// contains filtered or unexported fields
}

Consul implements the Consul provider.

func Provider

func Provider(cfg Config) *Consul

Provider returns an instance of the Consul provider.

func (*Consul) Read

func (c *Consul) Read() (map[string]interface{}, error)

Read reads configuration from the Consul provider.

func (*Consul) ReadBytes

func (c *Consul) ReadBytes() ([]byte, error)

ReadBytes is not supported by the Consul provider.

func (*Consul) Watch

func (c *Consul) Watch(cb func(event interface{}, err error)) error

Watch watches for changes in the Consul API and triggers a callback.

Directories

Path Synopsis
module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL