1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
12 "git.arvados.org/arvados.git/sdk/go/arvados"
13 "git.arvados.org/arvados.git/sdk/go/ctxlog"
14 "git.arvados.org/arvados.git/sdk/go/httpserver"
15 "github.com/prometheus/client_golang/prometheus"
16 "github.com/sirupsen/logrus"
24 func (srv *server) Start(logger *logrus.Logger) error {
25 h := &handler{Config: srv.Config}
26 reg := prometheus.NewRegistry()
27 h.Config.Cache.registry = reg
28 // Warning: when updating this to use Command() from
29 // lib/service, make sure to implement an exemption in
30 // httpserver.HandlerWithDeadline() so large file uploads are
31 // allowed to take longer than the usual API.RequestTimeout.
33 mh := httpserver.Instrument(reg, logger, httpserver.AddRequestIDs(httpserver.LogRequests(h)))
34 h.MetricsAPI = mh.ServeAPI(h.Config.cluster.ManagementToken, http.NotFoundHandler())
36 srv.BaseContext = func(net.Listener) context.Context { return ctxlog.Context(context.Background(), logger) }
37 var listen arvados.URL
38 for listen = range srv.Config.cluster.Services.WebDAV.InternalURLs {
41 if len(srv.Config.cluster.Services.WebDAV.InternalURLs) > 1 {
42 logrus.Warn("Services.WebDAV.InternalURLs has more than one key; picked: ", listen)
44 srv.Addr = listen.Host
45 return srv.Server.Start()