10690: Add -dump-config to arv-git-httpd, crunch-dispatch-slurm, keep-balance, keep...
[arvados.git] / services / arv-git-httpd / main.go
index 75645ff47215c2b5f7f666057006ea2510f99811..3ff155714c1b0f2223b13fe30e254782034acc2a 100644 (file)
@@ -10,6 +10,7 @@ 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
@@ -44,6 +45,7 @@ func main() {
                "Value for GITOLITE_HTTP_HOME environment variable. If not empty, GL_BYPASS_ACCESS_CHECKS=1 will also be set."+deprecated)
 
        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.Usage = usage
        flag.Parse()
 
@@ -63,6 +65,15 @@ func main() {
                }
        }
 
+       if *dumpConfig {
+               y, err := yaml.Marshal(theConfig)
+               if err != nil {
+                       log.Fatal(err)
+               }
+               os.Stdout.Write(y)
+               os.Exit(0)
+       }
+
        srv := &server{}
        if err := srv.Start(); err != nil {
                log.Fatal(err)