Merge branch '14670-new-java-sdk-docs' of git.curoverse.com:arvados into 14670-new...
[arvados.git] / services / keep-web / server.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 package main
6
7 import (
8         "net/http"
9
10         "git.curoverse.com/arvados.git/sdk/go/httpserver"
11         "github.com/prometheus/client_golang/prometheus"
12 )
13
14 type server struct {
15         httpserver.Server
16         Config *Config
17 }
18
19 func (srv *server) Start() error {
20         h := &handler{Config: srv.Config}
21         reg := prometheus.NewRegistry()
22         h.Config.Cache.registry = reg
23         mh := httpserver.Instrument(reg, nil, httpserver.AddRequestIDs(httpserver.LogRequests(nil, h)))
24         h.MetricsAPI = mh.ServeAPI(h.Config.ManagementToken, http.NotFoundHandler())
25         srv.Handler = mh
26         srv.Addr = srv.Config.Listen
27         return srv.Server.Start()
28 }