Merge pull request #3229 from halseth/fallback-hostname

lnd: fallback to localhost if failing getting hostname
This commit is contained in:
Johan T. Halseth 2019-07-08 14:57:36 +02:00 committed by GitHub
commit b162595929
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

5
lnd.go

@ -645,8 +645,11 @@ func genCertPair(certFile, keyFile string) error {
// Collect the host's names into a slice.
host, err := os.Hostname()
if err != nil {
return err
rpcsLog.Errorf("Failed getting hostname, falling back to "+
"localhost: %v", err)
host = "localhost"
}
dnsNames := []string{host}
if host != "localhost" {
dnsNames = append(dnsNames, "localhost")