option

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {

	// Flags from command line only.
	ShowVersion     bool   `yaml:"-"`
	ShowHelp        bool   `yaml:"-"`
	ShowConfig      bool   `yaml:"-"`
	ConfigFile      string `yaml:"-"`
	ForceNewCluster bool   `yaml:"-"`
	SignalUpgrade   bool   `yaml:"-"`

	// meta
	Name                            string            `yaml:"name" env:"EG_NAME"`
	Labels                          map[string]string `yaml:"labels" env:"EG_LABELS"`
	ClusterName                     string            `yaml:"cluster-name"`
	ClusterRole                     string            `yaml:"cluster-role"`
	ClusterRequestTimeout           string            `yaml:"cluster-request-timeout"`
	ClusterListenClientURLs         []string          `yaml:"cluster-listen-client-urls"`
	ClusterListenPeerURLs           []string          `yaml:"cluster-listen-peer-urls"`
	ClusterAdvertiseClientURLs      []string          `yaml:"cluster-advertise-client-urls"`
	ClusterInitialAdvertisePeerURLs []string          `yaml:"cluster-initial-advertise-peer-urls"`
	ClusterJoinURLs                 []string          `yaml:"cluster-join-urls"`
	APIAddr                         string            `yaml:"api-addr"`
	Debug                           bool              `yaml:"debug"`

	// Path.
	HomeDir   string `yaml:"home-dir"`
	DataDir   string `yaml:"data-dir"`
	WALDir    string `yaml:"wal-dir"`
	LogDir    string `yaml:"log-dir"`
	MemberDir string `yaml:"member-dir"`

	// Profile.
	CPUProfileFile    string `yaml:"cpu-profile-file"`
	MemoryProfileFile string `yaml:"memory-profile-file"`

	// Prepare the items below in advance.
	AbsHomeDir   string `yaml:"-"`
	AbsDataDir   string `yaml:"-"`
	AbsWALDir    string `yaml:"-"`
	AbsLogDir    string `yaml:"-"`
	AbsMemberDir string `yaml:"-"`
	// contains filtered or unexported fields
}

Options is the startup options.

func New

func New() *Options

New creates a default Options.

func (*Options) Parse

func (opt *Options) Parse() (string, error)

Parse parses all arguments, returns normal message without error if --help/--version set.

func (*Options) YAML

func (opt *Options) YAML() string

YAML returns yaml string of option, need to be called after calling Parse.

Jump to

Keyboard shortcuts

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