1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
11 "git.arvados.org/arvados.git/sdk/go/arvados"
12 "git.arvados.org/arvados.git/sdk/go/ctxlog"
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() error {
24 h := &handler{Config: srv.Config}
25 reg := prometheus.NewRegistry()
26 h.Config.Cache.registry = reg
27 ctx := ctxlog.Context(context.Background(), logrus.StandardLogger())
28 mh := httpserver.Instrument(reg, nil, httpserver.HandlerWithContext(ctx, httpserver.AddRequestIDs(httpserver.LogRequests(h))))
29 h.MetricsAPI = mh.ServeAPI(h.Config.cluster.ManagementToken, http.NotFoundHandler())
31 var listen arvados.URL
32 for listen = range srv.Config.cluster.Services.WebDAV.InternalURLs {
35 if len(srv.Config.cluster.Services.WebDAV.InternalURLs) > 1 {
36 logrus.Warn("Services.WebDAV.InternalURLs has more than one key; picked: ", listen)
38 srv.Addr = listen.Host
39 return srv.Server.Start()