flags

package
v0.0.0-...-534e0d3 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MPL-2.0 Imports: 16 Imported by: 1

Documentation

Overview

Package flags holds common flags that are shared between our commands.

Index

Constants

View Source
const (
	AddressesEnvVar = "CONSUL_ADDRESSES"
	GRPCPortEnvVar  = "CONSUL_GRPC_PORT"
	HTTPPortEnvVar  = "CONSUL_HTTP_PORT"

	NamespaceEnvVar  = "CONSUL_NAMESPACE"
	PartitionEnvVar  = "CONSUL_PARTITION"
	DatacenterEnvVar = "CONSUL_DATACENTER"

	ACLTokenEnvVar     = "CONSUL_ACL_TOKEN"
	ACLTokenFileEnvVar = "CONSUL_ACL_TOKEN_FILE"

	LoginAuthMethodEnvVar      = "CONSUL_LOGIN_AUTH_METHOD"
	LoginBearerTokenFileEnvVar = "CONSUL_LOGIN_BEARER_TOKEN_FILE"
	LoginDatacenterEnvVar      = "CONSUL_LOGIN_DATACENTER"
	LoginPartitionEnvVar       = "CONSUL_LOGIN_PARTITION"
	LoginNamespaceEnvVar       = "CONSUL_LOGIN_NAMESPACE"
	LoginMetaEnvVar            = "CONSUL_LOGIN_META"

	SkipServerWatchEnvVar = "CONSUL_SKIP_SERVER_WATCH"

	APITimeoutEnvVar = "CONSUL_API_TIMEOUT"
)

Variables

This section is empty.

Functions

func Merge

func Merge(dst, src *flag.FlagSet)

func ToSet

func ToSet(s []string) mapset.Set

ToSet creates a set from s.

func Usage

func Usage(txt string, flags *flag.FlagSet) string

Usage returns a usage string nicely formatted.

Types

type AppendSliceValue

type AppendSliceValue []string

AppendSliceValue implements the flag.Value interface and allows multiple calls to the same variable to append a list.

func (*AppendSliceValue) Set

func (s *AppendSliceValue) Set(value string) error

func (*AppendSliceValue) String

func (s *AppendSliceValue) String() string

type ConsulACLFlags

type ConsulACLFlags struct {
	ConsulLogin ConsulLoginFlags

	Token     string
	TokenFile string
}

type ConsulFlags

type ConsulFlags struct {
	Addresses  string
	GRPCPort   int
	HTTPPort   int
	APITimeout time.Duration

	Namespace  string
	Partition  string
	Datacenter string

	SkipServerWatch bool

	ConsulTLSFlags
	ConsulACLFlags
}

ConsulFlags is a set of flags used to connect to Consul (servers).

func (*ConsulFlags) ConsulClientConfig

func (f *ConsulFlags) ConsulClientConfig() *consul.Config

func (*ConsulFlags) ConsulServerConnMgrConfig

func (f *ConsulFlags) ConsulServerConnMgrConfig() (discovery.Config, error)

func (*ConsulFlags) Flags

func (f *ConsulFlags) Flags() *flag.FlagSet

type ConsulLoginFlags

type ConsulLoginFlags struct {
	AuthMethod      string
	BearerTokenFile string
	Datacenter      string
	Namespace       string
	Partition       string
	Meta            map[string]string
}

type ConsulTLSFlags

type ConsulTLSFlags struct {
	UseTLS        bool
	CACertFile    string
	CACertPEM     string
	TLSServerName string
}

type DurationValue

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

DurationValue provides a flag value that's aware if it has been set.

func (*DurationValue) Duration

func (d *DurationValue) Duration() time.Duration

String implements the flag.Value interface.

func (*DurationValue) Merge

func (d *DurationValue) Merge(onto *time.Duration)

Merge will overlay this value if it has been set.

func (*DurationValue) Set

func (d *DurationValue) Set(v string) error

Set implements the flag.Value interface.

func (*DurationValue) String

func (d *DurationValue) String() string

String implements the flag.Value interface.

type FlagMapValue

type FlagMapValue map[string]string

FlagMapValue is a flag implementation used to provide key=value semantics multiple times.

func (*FlagMapValue) Set

func (h *FlagMapValue) Set(value string) error

func (*FlagMapValue) String

func (h *FlagMapValue) String() string

type HTTPFlags

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

HTTPFlags are flags used to configure communication with a Consul agent.

func (*HTTPFlags) APIClient

func (f *HTTPFlags) APIClient() (*api.Client, error)

func (*HTTPFlags) Addr

func (f *HTTPFlags) Addr() string

func (*HTTPFlags) ConsulAPITimeout

func (f *HTTPFlags) ConsulAPITimeout() time.Duration

func (*HTTPFlags) Flags

func (f *HTTPFlags) Flags() *flag.FlagSet

func (*HTTPFlags) MergeOntoConfig

func (f *HTTPFlags) MergeOntoConfig(c *api.Config)

func (*HTTPFlags) Partition

func (f *HTTPFlags) Partition() string

func (*HTTPFlags) ReadTokenFile

func (f *HTTPFlags) ReadTokenFile() (string, error)

func (*HTTPFlags) SetToken

func (f *HTTPFlags) SetToken(v string) error

func (*HTTPFlags) SetTokenFile

func (f *HTTPFlags) SetTokenFile(v string) error

func (*HTTPFlags) TLSServerName

func (f *HTTPFlags) TLSServerName() string

func (*HTTPFlags) Token

func (f *HTTPFlags) Token() string

func (*HTTPFlags) TokenFile

func (f *HTTPFlags) TokenFile() string

type K8SFlags

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

func (*K8SFlags) Flags

func (f *K8SFlags) Flags() *flag.FlagSet

func (*K8SFlags) KubeConfig

func (f *K8SFlags) KubeConfig() string

type StringValue

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

StringValue provides a flag value that's aware if it has been set.

func (*StringValue) Merge

func (s *StringValue) Merge(onto *string)

Merge will overlay this value if it has been set.

func (*StringValue) Set

func (s *StringValue) Set(v string) error

Set implements the flag.Value interface.

func (*StringValue) String

func (s *StringValue) String() string

String implements the flag.Value interface.

type Usager

type Usager struct {
	Usage string
	Flags *flag.FlagSet
}

func (*Usager) String

func (u *Usager) String() string

Jump to

Keyboard shortcuts

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