config

package
v0.3.1-0...-f922a08 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2014 License: Apache-2.0 Imports: 14 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"`
	Peers            []string `toml:"peers" env:"ETCD_PEERS"`
	PeersFile        string   `toml:"peers_file" env:"ETCD_PEERS_FILE"`
	MaxClusterSize   int      `toml:"max_cluster_size" env:"ETCD_MAX_CLUSTER_SIZE"`
	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"`
	}

	GraphiteHost string `toml:"graphite_host" env:"ETCD_GRAPHITE_HOST"`
	// contains filtered or unexported fields
}

Config represents the server configuration.

func New

func New() *Config

New returns a Config initialized with default values.

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