1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
12 "git.arvados.org/arvados.git/lib/config"
13 "git.arvados.org/arvados.git/sdk/go/arvados"
14 "git.arvados.org/arvados.git/sdk/go/ctxlog"
15 "github.com/ghodss/yaml"
16 "github.com/sirupsen/logrus"
19 var logger = ctxlog.FromContext
22 func configure(log logrus.FieldLogger, args []string) *arvados.Cluster {
23 flags := flag.NewFlagSet(args[0], flag.ExitOnError)
24 dumpConfig := flags.Bool("dump-config", false, "show current configuration and exit")
25 getVersion := flags.Bool("version", false, "Print version information and exit.")
27 loader := config.NewLoader(nil, log)
28 loader.SetupFlags(flags)
29 args = loader.MungeLegacyConfigArgs(log, args[1:], "-legacy-ws-config")
33 // Print version information if requested
35 fmt.Printf("arvados-ws %s\n", version)
39 cfg, err := loader.Load()
44 cluster, err := cfg.GetCluster("")
49 ctxlog.SetLevel(cluster.SystemLogs.LogLevel)
50 ctxlog.SetFormat(cluster.SystemLogs.Format)
53 out, err := yaml.Marshal(cfg)
57 _, err = os.Stdout.Write(out)
69 cluster := configure(log, os.Args)
74 log.Printf("arvados-ws %s started", version)
75 srv := &server{cluster: cluster}