|
|
@@ -26,64 +26,64 @@ const DefaultSystemConfigPath = "/etc/etcd/etcd.conf"
|
|
|
|
|
|
// A lookup of deprecated flags to their new flag name.
|
|
|
var newFlagNameLookup = map[string]string{
|
|
|
- "C": "peers",
|
|
|
- "CF": "peers-file",
|
|
|
- "n": "name",
|
|
|
- "c": "addr",
|
|
|
- "cl": "bind-addr",
|
|
|
- "s": "peer-addr",
|
|
|
- "sl": "peer-bind-addr",
|
|
|
- "d": "data-dir",
|
|
|
- "m": "max-result-buffer",
|
|
|
- "r": "max-retry-attempts",
|
|
|
- "maxsize": "max-cluster-size",
|
|
|
- "clientCAFile": "ca-file",
|
|
|
- "clientCert": "cert-file",
|
|
|
- "clientKey": "key-file",
|
|
|
- "serverCAFile": "peer-ca-file",
|
|
|
- "serverCert": "peer-cert-file",
|
|
|
- "serverKey": "peer-key-file",
|
|
|
- "snapshotCount": "snapshot-count",
|
|
|
+ "C": "peers",
|
|
|
+ "CF": "peers-file",
|
|
|
+ "n": "name",
|
|
|
+ "c": "addr",
|
|
|
+ "cl": "bind-addr",
|
|
|
+ "s": "peer-addr",
|
|
|
+ "sl": "peer-bind-addr",
|
|
|
+ "d": "data-dir",
|
|
|
+ "m": "max-result-buffer",
|
|
|
+ "r": "max-retry-attempts",
|
|
|
+ "maxsize": "max-cluster-size",
|
|
|
+ "clientCAFile": "ca-file",
|
|
|
+ "clientCert": "cert-file",
|
|
|
+ "clientKey": "key-file",
|
|
|
+ "serverCAFile": "peer-ca-file",
|
|
|
+ "serverCert": "peer-cert-file",
|
|
|
+ "serverKey": "peer-key-file",
|
|
|
+ "snapshotCount": "snapshot-count",
|
|
|
}
|
|
|
|
|
|
// Config represents the server configuration.
|
|
|
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"`
|
|
|
- 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"`
|
|
|
- HeartbeatTimeout int `toml:"heartbeat_timeout" env:"ETCD_PEER_HEARTBEAT_TIMEOUT"`
|
|
|
- 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"`
|
|
|
+ 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"`
|
|
|
+ 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"`
|
|
|
+ HeartbeatTimeout int `toml:"heartbeat_timeout" env:"ETCD_PEER_HEARTBEAT_TIMEOUT"`
|
|
|
+ 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"`
|
|
|
}
|
|
|
|
|
|
// New returns a Config initialized with default values.
|
|
|
@@ -477,9 +477,9 @@ func (c *Config) Sanitize() error {
|
|
|
// TLSInfo retrieves a TLSInfo object for the client server.
|
|
|
func (c *Config) TLSInfo() server.TLSInfo {
|
|
|
return server.TLSInfo{
|
|
|
- CAFile: c.CAFile,
|
|
|
- CertFile: c.CertFile,
|
|
|
- KeyFile: c.KeyFile,
|
|
|
+ CAFile: c.CAFile,
|
|
|
+ CertFile: c.CertFile,
|
|
|
+ KeyFile: c.KeyFile,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -491,9 +491,9 @@ func (c *Config) TLSConfig() (server.TLSConfig, error) {
|
|
|
// PeerTLSInfo retrieves a TLSInfo object for the peer server.
|
|
|
func (c *Config) PeerTLSInfo() server.TLSInfo {
|
|
|
return server.TLSInfo{
|
|
|
- CAFile: c.Peer.CAFile,
|
|
|
- CertFile: c.Peer.CertFile,
|
|
|
- KeyFile: c.Peer.KeyFile,
|
|
|
+ CAFile: c.Peer.CAFile,
|
|
|
+ CertFile: c.Peer.CertFile,
|
|
|
+ KeyFile: c.Peer.KeyFile,
|
|
|
}
|
|
|
}
|
|
|
|