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/httpserver"
14 "github.com/prometheus/client_golang/prometheus"
15 "github.com/sirupsen/logrus"
23 func (srv *server) Start(ctx context.Context, logger *logrus.Logger) error {
24 h := &handler{Config: srv.Config}
25 reg := prometheus.NewRegistry()
26 h.Config.Cache.registry = reg
27 // Warning: when updating this to use Command() from
28 // lib/service, make sure to implement an exemption in
29 // httpserver.HandlerWithDeadline() so large file uploads are
30 // allowed to take longer than the usual API.RequestTimeout.
32 mh := httpserver.Instrument(reg, logger, httpserver.AddRequestIDs(httpserver.LogRequests(h)))
33 h.MetricsAPI = mh.ServeAPI(h.Config.cluster.ManagementToken, http.NotFoundHandler())
35 srv.BaseContext = func(net.Listener) context.Context { return ctx }
36 var listen arvados.URL
37 for listen = range srv.Config.cluster.Services.WebDAV.InternalURLs {
40 if len(srv.Config.cluster.Services.WebDAV.InternalURLs) > 1 {
41 logrus.Warn("Services.WebDAV.InternalURLs has more than one key; picked: ", listen)
43 srv.Addr = listen.Host
44 return srv.Server.Start()