consul

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: BSD-3-Clause Imports: 15 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

ginny-consul

consul provider for ginny.

Configuration is possible via the standard Consul Environment Variables and via the target URI passed to grpc.Dial.

To register the resolver with the grpc-go run:

resolver.Register(consul.NewBuilder())

Afterwards it can be used by calling grpc.Dial() and passing an URI in the following format:

consul://[<consul-server>]/<serviceName>[?<OPT>[&<OPT>]...]

<OPT> is one of:

OPT Format Default Description
scheme http|https default from github.com/hashicorp/consul/api Establish connection to consul via http or https.
tags <tag>,[,<tag>]... Filter service by tags
health healthy|fallbackToUnhealthy healthy healthy resolves only to services with a passing health status.
fallbackToUnhealthy resolves to unhealthy ones if none exist with passing healthy status.
token string default from github.com/hashicorp/consul/api Authenticate Consul API Request with the token.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProviderSet = wire.NewSet(NewClient, NewOptions)
)

ProviderSet

Functions

func NewBuilder added in v0.1.0

func NewBuilder() *resolverBuilder

func NewOptions

func NewOptions(v *viper.Viper) (*consulApi.Config, error)

NewOptions

Types

type Client

type Client struct {
	Config *consulApi.Config
	Client *consulApi.Client
}

Client

func NewClient added in v0.0.6

func NewClient(ctx context.Context, conf *consulApi.Config) (*Client, error)

NewClient

func (*Client) Resolver added in v0.0.5

func (p *Client) Resolver(ctx context.Context, service string, tags []string) (addr string, err error)

Resolver

func (*Client) ServiceDeregister added in v0.0.4

func (p *Client) ServiceDeregister(ctx context.Context, service string) error

ServiceDeregister

func (*Client) ServiceRegister added in v0.0.4

func (p *Client) ServiceRegister(ctx context.Context, service, addr string, tags []string, meta map[string]string) error

ServiceRegister

Jump to

Keyboard shortcuts

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