mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #1704 from xiang90/print_config
*: print out configuration when necessary
This commit is contained in:
commit
6a1fe00615
@ -224,6 +224,9 @@ func startEtcd() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if !peerTLSInfo.Empty() {
|
||||
log.Printf("etcd: peerTLS: %s", peerTLSInfo)
|
||||
}
|
||||
plns := make([]net.Listener, 0)
|
||||
for _, u := range lpurls {
|
||||
var l net.Listener
|
||||
@ -248,6 +251,9 @@ func startEtcd() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if !clientTLSInfo.Empty() {
|
||||
log.Printf("etcd: clientTLS: %s", clientTLSInfo)
|
||||
}
|
||||
clns := make([]net.Listener, 0)
|
||||
for _, u := range lcurls {
|
||||
var l net.Listener
|
||||
@ -287,6 +293,9 @@ func startEtcd() error {
|
||||
}
|
||||
s.Start()
|
||||
|
||||
if corsInfo.String() != "" {
|
||||
log.Printf("etcd: cors = %s", corsInfo)
|
||||
}
|
||||
ch := &cors.CORSHandler{
|
||||
Handler: etcdhttp.NewClientHandler(s),
|
||||
Info: corsInfo,
|
||||
|
@ -18,6 +18,7 @@ package etcdserver
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"path"
|
||||
"reflect"
|
||||
@ -85,3 +86,31 @@ func (c *ServerConfig) SnapDir() string { return path.Join(c.DataDir, "snap") }
|
||||
func (c *ServerConfig) ShouldDiscover() bool {
|
||||
return c.DiscoveryURL != ""
|
||||
}
|
||||
|
||||
func (c *ServerConfig) PrintWithInitial() {
|
||||
c.print(true)
|
||||
}
|
||||
|
||||
func (c *ServerConfig) Print() {
|
||||
c.print(false)
|
||||
}
|
||||
|
||||
func (c *ServerConfig) print(initial bool) {
|
||||
log.Printf("etcdserver: name = %s", c.Name)
|
||||
if c.ForceNewCluster {
|
||||
log.Println("etcdserver: force new cluster")
|
||||
}
|
||||
log.Printf("etcdserver: data dir = %s", c.DataDir)
|
||||
log.Printf("etcdserver: snapshot count = %d", c.SnapCount)
|
||||
if len(c.DiscoveryURL) != 0 {
|
||||
log.Printf("etcdserver: discovery URL= %s", c.DiscoveryURL)
|
||||
if len(c.DiscoveryProxy) != 0 {
|
||||
log.Printf("etcdserver: discovery proxy = %s", c.DiscoveryProxy)
|
||||
}
|
||||
}
|
||||
log.Printf("etcdserver: advertise client URLs = %s", c.ClientURLs)
|
||||
if initial {
|
||||
log.Printf("etcdserver: initial advertise peer URLs = %s", c.PeerURLs)
|
||||
log.Printf("etcdserver: initial cluster = %s", c.Cluster)
|
||||
}
|
||||
}
|
||||
|
@ -211,6 +211,7 @@ func NewServer(cfg *ServerConfig) (*EtcdServer, error) {
|
||||
}
|
||||
cfg.Cluster.SetID(cl.id)
|
||||
cfg.Cluster.SetStore(st)
|
||||
cfg.Print()
|
||||
id, n, w = startNode(cfg, nil)
|
||||
case !haveWAL && cfg.NewCluster:
|
||||
if err := cfg.VerifyBootstrapConfig(); err != nil {
|
||||
@ -230,7 +231,7 @@ func NewServer(cfg *ServerConfig) (*EtcdServer, error) {
|
||||
}
|
||||
}
|
||||
cfg.Cluster.SetStore(st)
|
||||
log.Printf("etcdserver: initial cluster members: %s", cfg.Cluster)
|
||||
cfg.PrintWithInitial()
|
||||
id, n, w = startNode(cfg, cfg.Cluster.MemberIDs())
|
||||
case haveWAL:
|
||||
if cfg.ShouldDiscover() {
|
||||
@ -247,6 +248,7 @@ func NewServer(cfg *ServerConfig) (*EtcdServer, error) {
|
||||
index = snapshot.Index
|
||||
}
|
||||
cfg.Cluster = NewClusterFromStore(cfg.Cluster.token, st)
|
||||
cfg.Print()
|
||||
if snapshot != nil {
|
||||
log.Printf("etcdserver: loaded peers from snapshot: %s", cfg.Cluster)
|
||||
}
|
||||
|
@ -74,6 +74,10 @@ type TLSInfo struct {
|
||||
parseFunc func([]byte, []byte) (tls.Certificate, error)
|
||||
}
|
||||
|
||||
func (info TLSInfo) String() string {
|
||||
return fmt.Sprintf("cert = %s, key = %s, ca = %s", info.CertFile, info.KeyFile, info.CAFile)
|
||||
}
|
||||
|
||||
func (info TLSInfo) Empty() bool {
|
||||
return info.CertFile == "" && info.KeyFile == ""
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user