consulcli

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: MIT Imports: 2 Imported by: 1

README

consulcli

Connect to the consul service client.

Example of use

    import "github.com/zhufuyi/sponge/pkg/consulcli"

	endpoints := []string{"192.168.3.37:2379"}
    cli, err := consulcli.Init(endpoints,
        WithConnectTimeout(time.Second*2),
        // WithAuth("", ""),
        // WithAutoSyncInterval(0),
        // WithLog(zap.NewNop()),
	)

Documentation

Overview

Package consulcli is connecting to the consul service client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(addr string, opts ...Option) (*api.Client, error)

Init connecting to the consul service

Types

type Option

type Option func(*options)

Option set the consul client options.

func WithDatacenter

func WithDatacenter(datacenter string) Option

WithDatacenter set datacenter

func WithScheme

func WithScheme(scheme string) Option

WithScheme set scheme

func WithWaitTime

func WithWaitTime(waitTime time.Duration) Option

WithWaitTime set wait time

Jump to

Keyboard shortcuts

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