1package internal 2 3import ( 4 "net/url" 5) 6 7var EtcdDefaultArgs = []string{ 8 "--listen-peer-urls=http://localhost:0", 9 "--advertise-client-urls={{ if .URL }}{{ .URL.String }}{{ end }}", 10 "--listen-client-urls={{ if .URL }}{{ .URL.String }}{{ end }}", 11 "--data-dir={{ .DataDir }}", 12} 13 14func DoEtcdArgDefaulting(args []string) []string { 15 if len(args) != 0 { 16 return args 17 } 18 19 return EtcdDefaultArgs 20} 21 22func isSecureScheme(scheme string) bool { 23 // https://github.com/coreos/etcd/blob/d9deeff49a080a88c982d328ad9d33f26d1ad7b6/pkg/transport/listener.go#L53 24 if scheme == "https" || scheme == "unixs" { 25 return true 26 } 27 return false 28} 29 30func GetEtcdStartMessage(listenURL url.URL) string { 31 if isSecureScheme(listenURL.Scheme) { 32 // https://github.com/coreos/etcd/blob/a7f1fbe00ec216fcb3a1919397a103b41dca8413/embed/serve.go#L167 33 return "serving client requests on " 34 } 35 36 // https://github.com/coreos/etcd/blob/a7f1fbe00ec216fcb3a1919397a103b41dca8413/embed/serve.go#L124 37 return "serving insecure client requests on " 38} 39