Merge branch '10690-config-dump' refs #10690
[arvados.git] / services / arv-git-httpd / main.go
index 4d6d8f668aa2c2cf37289a6e7da95262810d8ae8..75645ff47215c2b5f7f666057006ea2510f99811 100644 (file)
@@ -14,10 +14,11 @@ import (
 
 // Server configuration
 type Config struct {
-       Client     arvados.Client
-       Listen     string
-       GitCommand string
-       RepoRoot   string
+       Client       arvados.Client
+       Listen       string
+       GitCommand   string
+       RepoRoot     string
+       GitoliteHome string
 }
 
 var theConfig = defaultConfig()
@@ -30,7 +31,7 @@ func defaultConfig() *Config {
        }
 }
 
-func init() {
+func main() {
        const defaultCfgPath = "/etc/arvados/git-httpd/git-httpd.yml"
        const deprecated = " (DEPRECATED -- use config file instead)"
        flag.StringVar(&theConfig.Listen, "address", theConfig.Listen,
@@ -39,6 +40,8 @@ func init() {
                "Path to git or gitolite-shell executable. Each authenticated request will execute this program with a single argument, \"http-backend\"."+deprecated)
        flag.StringVar(&theConfig.RepoRoot, "repo-root", theConfig.RepoRoot,
                "Path to git repositories."+deprecated)
+       flag.StringVar(&theConfig.GitoliteHome, "gitolite-home", theConfig.GitoliteHome,
+               "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`.")
        flag.Usage = usage
@@ -59,14 +62,12 @@ func init() {
                        log.Print("Current configuration:\n", string(j))
                }
        }
-}
 
-func main() {
        srv := &server{}
        if err := srv.Start(); err != nil {
                log.Fatal(err)
        }
-       if _, err := daemon.SdNotify("READY=1"); err != nil {
+       if _, err := daemon.SdNotify(false, "READY=1"); err != nil {
                log.Printf("Error notifying init daemon: %v", err)
        }
        log.Println("Listening at", srv.Addr)