consul

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: MIT Imports: 6 Imported by: 1

README

Consul

Consul loader have dynamic read and read/write/delete key-value pairs from consul.

go get github.com/rytsh/liz/loader/consul

Usage

Environment variable Description
CONSUL_HTTP_ADDR Consul address
CONSUL_HTTP_TOKEN_FILE Consul token file
CONSUL_HTTP_TOKEN Consul token
CONSUL_HTTP_AUTH Consul auth
CONSUL_HTTP_SSL Consul ssl
CONSUL_TLS_SERVER_NAME Consul tls server name
CONSUL_CACERT Consul cacert
CONSUL_CAPATH Consul capath
CONSUL_CLIENT_CERT Consul client cert
CONSUL_CLIENT_KEY Consul client key
CONSUL_HTTP_SSL_VERIFY Consul ssl verify
CONSUL_NAMESPACE Consul namespace
CONSUL_PARTITION Consul partition

Test

make test-env
# make test-env html-wsl TEST=coverage

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Client       *api.Client
	KV           *api.KV
	QueryOptions api.QueryOptions
	WriteOptions api.WriteOptions
}

func (*API) Connect

func (c *API) Connect() error

func (*API) Delete

func (c *API) Delete(ctx context.Context, key string) error

func (*API) DynamicValue

func (c *API) DynamicValue(ctx context.Context, wg *sync.WaitGroup, key string) (<-chan []byte, func(), error)

DynamicValue return a channel for getting latest value of key. This function will start a goroutine for watching key. The caller should call stop function when it is no longer needed.

func (*API) LoadRaw

func (c *API) LoadRaw(ctx context.Context, key string) ([]byte, error)

func (*API) SetRaw

func (c *API) SetRaw(ctx context.Context, key string, value []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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