mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #283 from philips/use-hostname-as-machine-name
feat(etcd): use hostname as machine name
This commit is contained in:
commit
0c4b45d4fb
7
etcd.go
7
etcd.go
@ -42,7 +42,12 @@ func main() {
|
||||
log.Fatal("info:", err)
|
||||
}
|
||||
if info.Name == "" {
|
||||
log.Fatal("ERROR: server name required. e.g. '-n=server_name'")
|
||||
host, err := os.Hostname()
|
||||
if err != nil || host == "" {
|
||||
log.Fatal("Machine name required and hostname not set. e.g. '-n=machine_name'")
|
||||
}
|
||||
log.Warnf("Using hostname %s as the machine name. You must ensure this name is unique among etcd machines.", host)
|
||||
info.Name = host
|
||||
}
|
||||
|
||||
// Retrieve TLS configuration.
|
||||
|
Loading…
x
Reference in New Issue
Block a user