chore(config): go fmt
This commit is contained in:
116
config/config.go
116
config/config.go
@ -26,64 +26,64 @@ const DefaultSystemConfigPath = "/etc/etcd/etcd.conf"
|
|||||||
|
|
||||||
// A lookup of deprecated flags to their new flag name.
|
// A lookup of deprecated flags to their new flag name.
|
||||||
var newFlagNameLookup = map[string]string{
|
var newFlagNameLookup = map[string]string{
|
||||||
"C": "peers",
|
"C": "peers",
|
||||||
"CF": "peers-file",
|
"CF": "peers-file",
|
||||||
"n": "name",
|
"n": "name",
|
||||||
"c": "addr",
|
"c": "addr",
|
||||||
"cl": "bind-addr",
|
"cl": "bind-addr",
|
||||||
"s": "peer-addr",
|
"s": "peer-addr",
|
||||||
"sl": "peer-bind-addr",
|
"sl": "peer-bind-addr",
|
||||||
"d": "data-dir",
|
"d": "data-dir",
|
||||||
"m": "max-result-buffer",
|
"m": "max-result-buffer",
|
||||||
"r": "max-retry-attempts",
|
"r": "max-retry-attempts",
|
||||||
"maxsize": "max-cluster-size",
|
"maxsize": "max-cluster-size",
|
||||||
"clientCAFile": "ca-file",
|
"clientCAFile": "ca-file",
|
||||||
"clientCert": "cert-file",
|
"clientCert": "cert-file",
|
||||||
"clientKey": "key-file",
|
"clientKey": "key-file",
|
||||||
"serverCAFile": "peer-ca-file",
|
"serverCAFile": "peer-ca-file",
|
||||||
"serverCert": "peer-cert-file",
|
"serverCert": "peer-cert-file",
|
||||||
"serverKey": "peer-key-file",
|
"serverKey": "peer-key-file",
|
||||||
"snapshotCount": "snapshot-count",
|
"snapshotCount": "snapshot-count",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config represents the server configuration.
|
// Config represents the server configuration.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
SystemPath string
|
SystemPath string
|
||||||
|
|
||||||
Addr string `toml:"addr" env:"ETCD_ADDR"`
|
Addr string `toml:"addr" env:"ETCD_ADDR"`
|
||||||
BindAddr string `toml:"bind_addr" env:"ETCD_BIND_ADDR"`
|
BindAddr string `toml:"bind_addr" env:"ETCD_BIND_ADDR"`
|
||||||
CAFile string `toml:"ca_file" env:"ETCD_CA_FILE"`
|
CAFile string `toml:"ca_file" env:"ETCD_CA_FILE"`
|
||||||
CertFile string `toml:"cert_file" env:"ETCD_CERT_FILE"`
|
CertFile string `toml:"cert_file" env:"ETCD_CERT_FILE"`
|
||||||
CPUProfileFile string
|
CPUProfileFile string
|
||||||
CorsOrigins []string `toml:"cors" env:"ETCD_CORS"`
|
CorsOrigins []string `toml:"cors" env:"ETCD_CORS"`
|
||||||
DataDir string `toml:"data_dir" env:"ETCD_DATA_DIR"`
|
DataDir string `toml:"data_dir" env:"ETCD_DATA_DIR"`
|
||||||
Discovery string `toml:"discovery" env:"ETCD_DISCOVERY"`
|
Discovery string `toml:"discovery" env:"ETCD_DISCOVERY"`
|
||||||
Force bool
|
Force bool
|
||||||
KeyFile string `toml:"key_file" env:"ETCD_KEY_FILE"`
|
KeyFile string `toml:"key_file" env:"ETCD_KEY_FILE"`
|
||||||
Peers []string `toml:"peers" env:"ETCD_PEERS"`
|
Peers []string `toml:"peers" env:"ETCD_PEERS"`
|
||||||
PeersFile string `toml:"peers_file" env:"ETCD_PEERS_FILE"`
|
PeersFile string `toml:"peers_file" env:"ETCD_PEERS_FILE"`
|
||||||
MaxClusterSize int `toml:"max_cluster_size" env:"ETCD_MAX_CLUSTER_SIZE"`
|
MaxClusterSize int `toml:"max_cluster_size" env:"ETCD_MAX_CLUSTER_SIZE"`
|
||||||
MaxResultBuffer int `toml:"max_result_buffer" env:"ETCD_MAX_RESULT_BUFFER"`
|
MaxResultBuffer int `toml:"max_result_buffer" env:"ETCD_MAX_RESULT_BUFFER"`
|
||||||
MaxRetryAttempts int `toml:"max_retry_attempts" env:"ETCD_MAX_RETRY_ATTEMPTS"`
|
MaxRetryAttempts int `toml:"max_retry_attempts" env:"ETCD_MAX_RETRY_ATTEMPTS"`
|
||||||
Name string `toml:"name" env:"ETCD_NAME"`
|
Name string `toml:"name" env:"ETCD_NAME"`
|
||||||
Snapshot bool `toml:"snapshot" env:"ETCD_SNAPSHOT"`
|
Snapshot bool `toml:"snapshot" env:"ETCD_SNAPSHOT"`
|
||||||
SnapshotCount int `toml:"snapshot_count" env:"ETCD_SNAPSHOTCOUNT"`
|
SnapshotCount int `toml:"snapshot_count" env:"ETCD_SNAPSHOTCOUNT"`
|
||||||
ShowHelp bool
|
ShowHelp bool
|
||||||
ShowVersion bool
|
ShowVersion bool
|
||||||
Verbose bool `toml:"verbose" env:"ETCD_VERBOSE"`
|
Verbose bool `toml:"verbose" env:"ETCD_VERBOSE"`
|
||||||
VeryVerbose bool `toml:"very_verbose" env:"ETCD_VERY_VERBOSE"`
|
VeryVerbose bool `toml:"very_verbose" env:"ETCD_VERY_VERBOSE"`
|
||||||
VeryVeryVerbose bool `toml:"very_very_verbose" env:"ETCD_VERY_VERY_VERBOSE"`
|
VeryVeryVerbose bool `toml:"very_very_verbose" env:"ETCD_VERY_VERY_VERBOSE"`
|
||||||
Peer struct {
|
Peer struct {
|
||||||
Addr string `toml:"addr" env:"ETCD_PEER_ADDR"`
|
Addr string `toml:"addr" env:"ETCD_PEER_ADDR"`
|
||||||
BindAddr string `toml:"bind_addr" env:"ETCD_PEER_BIND_ADDR"`
|
BindAddr string `toml:"bind_addr" env:"ETCD_PEER_BIND_ADDR"`
|
||||||
CAFile string `toml:"ca_file" env:"ETCD_PEER_CA_FILE"`
|
CAFile string `toml:"ca_file" env:"ETCD_PEER_CA_FILE"`
|
||||||
CertFile string `toml:"cert_file" env:"ETCD_PEER_CERT_FILE"`
|
CertFile string `toml:"cert_file" env:"ETCD_PEER_CERT_FILE"`
|
||||||
KeyFile string `toml:"key_file" env:"ETCD_PEER_KEY_FILE"`
|
KeyFile string `toml:"key_file" env:"ETCD_PEER_KEY_FILE"`
|
||||||
HeartbeatTimeout int `toml:"heartbeat_timeout" env:"ETCD_PEER_HEARTBEAT_TIMEOUT"`
|
HeartbeatTimeout int `toml:"heartbeat_timeout" env:"ETCD_PEER_HEARTBEAT_TIMEOUT"`
|
||||||
ElectionTimeout int `toml:"election_timeout" env:"ETCD_PEER_ELECTION_TIMEOUT"`
|
ElectionTimeout int `toml:"election_timeout" env:"ETCD_PEER_ELECTION_TIMEOUT"`
|
||||||
}
|
}
|
||||||
strTrace string `toml:"trace" env:"ETCD_TRACE"`
|
strTrace string `toml:"trace" env:"ETCD_TRACE"`
|
||||||
GraphiteHost string `toml:"graphite_host" env:"ETCD_GRAPHITE_HOST"`
|
GraphiteHost string `toml:"graphite_host" env:"ETCD_GRAPHITE_HOST"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// New returns a Config initialized with default values.
|
// 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.
|
// TLSInfo retrieves a TLSInfo object for the client server.
|
||||||
func (c *Config) TLSInfo() server.TLSInfo {
|
func (c *Config) TLSInfo() server.TLSInfo {
|
||||||
return server.TLSInfo{
|
return server.TLSInfo{
|
||||||
CAFile: c.CAFile,
|
CAFile: c.CAFile,
|
||||||
CertFile: c.CertFile,
|
CertFile: c.CertFile,
|
||||||
KeyFile: c.KeyFile,
|
KeyFile: c.KeyFile,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,9 +491,9 @@ func (c *Config) TLSConfig() (server.TLSConfig, error) {
|
|||||||
// PeerTLSInfo retrieves a TLSInfo object for the peer server.
|
// PeerTLSInfo retrieves a TLSInfo object for the peer server.
|
||||||
func (c *Config) PeerTLSInfo() server.TLSInfo {
|
func (c *Config) PeerTLSInfo() server.TLSInfo {
|
||||||
return server.TLSInfo{
|
return server.TLSInfo{
|
||||||
CAFile: c.Peer.CAFile,
|
CAFile: c.Peer.CAFile,
|
||||||
CertFile: c.Peer.CertFile,
|
CertFile: c.Peer.CertFile,
|
||||||
KeyFile: c.Peer.KeyFile,
|
KeyFile: c.Peer.KeyFile,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user