consul

package
v1.3.12 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadJSONConf

func LoadJSONConf(client *api.Client, key string, v any)

LoadJSONConf load config from consul kv

func LoadYAMLConf

func LoadYAMLConf(client *api.Client, key string, v any)

LoadYAMLConf load config from consul kv

func RegisterService

func RegisterService(c Conf) error

RegisterService register service to consul

Types

type Conf

type Conf struct {
	Host     string
	ListenOn string
	Key      string
	Token    string            `json:",optional"`
	Tag      []string          `json:",optional"`
	Meta     map[string]string `json:",optional"`
	TTL      int               `json:"ttl,optional"`
}

Conf is the config item with the given key on etcd.

func (Conf) NewClient

func (c Conf) NewClient() (*api.Client, error)

NewClient create new client

func (Conf) Validate

func (c Conf) Validate() error

Validate validates c.

Jump to

Keyboard shortcuts

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