1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
12 "git.arvados.org/arvados.git/lib/service"
13 "git.arvados.org/arvados.git/sdk/go/arvados"
14 "git.arvados.org/arvados.git/sdk/go/ctxlog"
15 "git.arvados.org/arvados.git/sdk/go/keepclient"
16 "github.com/prometheus/client_golang/prometheus"
19 var Command = service.Command(arvados.ServiceNameKeepweb, newHandlerOrErrorHandler)
21 func newHandlerOrErrorHandler(ctx context.Context, cluster *arvados.Cluster, token string, reg *prometheus.Registry) service.Handler {
22 h, err := newHandler(ctx, cluster, token, reg)
24 return service.ErrorHandler(ctx, cluster, err)
29 func newHandler(ctx context.Context, cluster *arvados.Cluster, token string, reg *prometheus.Registry) (*handler, error) {
30 logger := ctxlog.FromContext(ctx)
31 if ext := ".txt"; mime.TypeByExtension(ext) == "" {
32 logger.Warnf("cannot look up MIME type for %q -- this probably means /etc/mime.types is missing -- clients will see incorrect content types", ext)
35 keepclient.RefreshServiceDiscoveryOnSIGHUP()
36 os.Setenv("ARVADOS_API_HOST", cluster.Services.Controller.ExternalURL.Host)
44 metrics: newMetrics(reg),