X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/8cd08f2ce640e0b1967db489d29e3761ac63f0d7..ae44eb7e4d96e44ca3dc0481cef7cef354a23292:/lib/boot/supervisor.go diff --git a/lib/boot/supervisor.go b/lib/boot/supervisor.go index c75e7f146e..961ed55de3 100644 --- a/lib/boot/supervisor.go +++ b/lib/boot/supervisor.go @@ -443,7 +443,7 @@ func (super *Supervisor) setupRubyEnv() error { cmd.Env = super.environ buf, err := cmd.Output() // /var/lib/arvados/.gem/ruby/2.5.0/bin:... if err != nil || len(buf) == 0 { - return fmt.Errorf("gem env gempath: %v", err) + return fmt.Errorf("gem env gempath: %w", err) } gempath := string(bytes.Split(buf, []byte{':'})[0]) super.prependEnv("PATH", gempath+"/bin:") @@ -734,7 +734,7 @@ func (super *Supervisor) autofillConfig(cfg *arvados.Config) error { if super.OwnTemporaryDatabase { cluster.PostgreSQL.Connection = arvados.PostgreSQLConnection{ "client_encoding": "utf8", - "host": "localhost", + "host": super.ListenHost, "port": nextPort(super.ListenHost), "dbname": "arvados_test", "user": "arvados", @@ -768,21 +768,23 @@ func randomHexString(chars int) string { return fmt.Sprintf("%x", b) } -func internalPort(svc arvados.Service) (string, error) { +func internalPort(svc arvados.Service) (host, port string, err error) { if len(svc.InternalURLs) > 1 { - return "", errors.New("internalPort() doesn't work with multiple InternalURLs") + return "", "", errors.New("internalPort() doesn't work with multiple InternalURLs") } for u := range svc.InternalURLs { u := url.URL(u) - if p := u.Port(); p != "" { - return p, nil - } else if u.Scheme == "https" || u.Scheme == "ws" { - return "443", nil - } else { - return "80", nil + host, port = u.Hostname(), u.Port() + switch { + case port != "": + case u.Scheme == "https", u.Scheme == "ws": + port = "443" + default: + port = "80" } + return } - return "", fmt.Errorf("service has no InternalURLs") + return "", "", fmt.Errorf("service has no InternalURLs") } func externalPort(svc arvados.Service) (string, error) {