12033: Generalize MultisiteLoader to MergingLoader.
[arvados.git] / services / arv-git-httpd / main.go
index 3ff155714c1b0f2223b13fe30e254782034acc2a..79a3eb3f7b85de9667c04fe1b24f2a5217db5772 100644 (file)
@@ -1,3 +1,7 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
 package main
 
 import (
@@ -10,16 +14,16 @@ import (
        "git.curoverse.com/arvados.git/sdk/go/arvados"
        "git.curoverse.com/arvados.git/sdk/go/config"
        "github.com/coreos/go-systemd/daemon"
-       "github.com/ghodss/yaml"
 )
 
 // Server configuration
 type Config struct {
-       Client       arvados.Client
-       Listen       string
-       GitCommand   string
-       RepoRoot     string
-       GitoliteHome string
+       Client          arvados.Client
+       Listen          string
+       GitCommand      string
+       RepoRoot        string
+       GitoliteHome    string
+       ManagementToken string
 }
 
 var theConfig = defaultConfig()
@@ -46,6 +50,10 @@ func main() {
 
        cfgPath := flag.String("config", defaultCfgPath, "Configuration file `path`.")
        dumpConfig := flag.Bool("dump-config", false, "write current configuration to stdout and exit (useful for migrating from command line flags to config file)")
+
+       flag.StringVar(&theConfig.ManagementToken, "management-token", theConfig.ManagementToken,
+               "Authorization token to be included in all health check requests.")
+
        flag.Usage = usage
        flag.Parse()
 
@@ -66,12 +74,7 @@ func main() {
        }
 
        if *dumpConfig {
-               y, err := yaml.Marshal(theConfig)
-               if err != nil {
-                       log.Fatal(err)
-               }
-               os.Stdout.Write(y)
-               os.Exit(0)
+               log.Fatal(config.DumpAndExit(theConfig))
        }
 
        srv := &server{}