config

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2015 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultSystemConfigPath = "/etc/etcd/etcd.conf"

The default location for the etcd configuration file.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SystemPath string

	Addr             string `toml:"addr" env:"ETCD_ADDR"`
	BindAddr         string `toml:"bind_addr" env:"ETCD_BIND_ADDR"`
	CAFile           string `toml:"ca_file" env:"ETCD_CA_FILE"`
	CertFile         string `toml:"cert_file" env:"ETCD_CERT_FILE"`
	CPUProfileFile   string
	CorsOrigins      []string `toml:"cors" env:"ETCD_CORS"`
	DataDir          string   `toml:"data_dir" env:"ETCD_DATA_DIR"`
	Discovery        string   `toml:"discovery" env:"ETCD_DISCOVERY"`
	Force            bool
	KeyFile          string   `toml:"key_file" env:"ETCD_KEY_FILE"`
	HTTPReadTimeout  float64  `toml:"http_read_timeout" env:"ETCD_HTTP_READ_TIMEOUT"`
	HTTPWriteTimeout float64  `toml:"http_write_timeout" env:"ETCD_HTTP_WRITE_TIMEOUT"`
	Peers            []string `toml:"peers" env:"ETCD_PEERS"`
	PeersFile        string   `toml:"peers_file" env:"ETCD_PEERS_FILE"`
	MaxResultBuffer  int      `toml:"max_result_buffer" env:"ETCD_MAX_RESULT_BUFFER"`
	MaxRetryAttempts int      `toml:"max_retry_attempts" env:"ETCD_MAX_RETRY_ATTEMPTS"`
	RetryInterval    float64  `toml:"retry_interval" env:"ETCD_RETRY_INTERVAL"`
	Name             string   `toml:"name" env:"ETCD_NAME"`
	Snapshot         bool     `toml:"snapshot" env:"ETCD_SNAPSHOT"`
	SnapshotCount    int      `toml:"snapshot_count" env:"ETCD_SNAPSHOTCOUNT"`
	ShowHelp         bool
	ShowVersion      bool
	Verbose          bool `toml:"verbose" env:"ETCD_VERBOSE"`
	VeryVerbose      bool `toml:"very_verbose" env:"ETCD_VERY_VERBOSE"`
	VeryVeryVerbose  bool `toml:"very_very_verbose" env:"ETCD_VERY_VERY_VERBOSE"`
	Peer             struct {
		Addr              string `toml:"addr" env:"ETCD_PEER_ADDR"`
		BindAddr          string `toml:"bind_addr" env:"ETCD_PEER_BIND_ADDR"`
		CAFile            string `toml:"ca_file" env:"ETCD_PEER_CA_FILE"`
		CertFile          string `toml:"cert_file" env:"ETCD_PEER_CERT_FILE"`
		KeyFile           string `toml:"key_file" env:"ETCD_PEER_KEY_FILE"`
		HeartbeatInterval int    `toml:"heartbeat_interval" env:"ETCD_PEER_HEARTBEAT_INTERVAL"`
		ElectionTimeout   int    `toml:"election_timeout" env:"ETCD_PEER_ELECTION_TIMEOUT"`
	}
	StrTrace     string `toml:"trace" env:"ETCD_TRACE"`
	GraphiteHost string `toml:"graphite_host" env:"ETCD_GRAPHITE_HOST"`
	Cluster      struct {
		ActiveSize   int     `toml:"active_size" env:"ETCD_CLUSTER_ACTIVE_SIZE"`
		RemoveDelay  float64 `toml:"remove_delay" env:"ETCD_CLUSTER_REMOVE_DELAY"`
		SyncInterval float64 `toml:"sync_interval" env:"ETCD_CLUSTER_SYNC_INTERVAL"`
	}
}

Config represents the server configuration.

func New

func New() *Config

New returns a Config initialized with default values.

func (*Config) ClusterConfig added in v0.4.0

func (c *Config) ClusterConfig() *server.ClusterConfig

func (*Config) DataDirFromName

func (c *Config) DataDirFromName()

DataDirFromName sets the data dir from a machine name and issue a warning that etcd is guessing.

func (*Config) EtcdTLSInfo

func (c *Config) EtcdTLSInfo() *server.TLSInfo

EtcdTLSInfo retrieves a TLSInfo object for the etcd server

func (*Config) Load

func (c *Config) Load(arguments []string) error

Loads the configuration from the system config, command line config, environment variables, and finally command line arguments.

func (*Config) LoadEnv

func (c *Config) LoadEnv() error

LoadEnv loads the configuration via environment variables.

func (*Config) LoadFile

func (c *Config) LoadFile(path string) error

Loads configuration from a file.

func (*Config) LoadFlags

func (c *Config) LoadFlags(arguments []string) error

Loads configuration from command line flags.

func (*Config) LoadPeersFile

func (c *Config) LoadPeersFile() error

LoadPeersFile loads the peers listed in the peers file.

func (*Config) LoadSystemFile

func (c *Config) LoadSystemFile() error

Loads from the system etcd configuration file if it exists.

func (*Config) MetricsBucketName

func (c *Config) MetricsBucketName() string

MetricsBucketName generates the name that should be used for a corresponding MetricsBucket object

func (*Config) NameFromHostname

func (c *Config) NameFromHostname()

NameFromHostname sets the machine name from the hostname. This is to help people get started without thinking up a name.

func (*Config) PeerTLSInfo

func (c *Config) PeerTLSInfo() *server.TLSInfo

PeerRaftInfo retrieves a TLSInfo object for the peer server.

func (*Config) Reset

func (c *Config) Reset() error

Reset removes all server configuration files.

func (*Config) Sanitize

func (c *Config) Sanitize() error

Sanitize cleans the input fields.

func (*Config) Trace

func (c *Config) Trace() bool

Trace determines if any trace-level information should be emitted

Jump to

Keyboard shortcuts

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