Example #1
0
func main() {
	if len(os.Args) != 1 {
		fmt.Printf(`git-server - Expose Git repositories to the network

%[1]s`, gitserver.EnvironmentHelp)
		os.Exit(0)
	}
	config, err := gitserver.NewEnviromentConfig()
	if err != nil {
		log.Fatal(err)
	}
	log.Fatal(gitserver.Start(config))
}
Example #2
0
func RunGitServer() error {
	config, err := gitserver.NewEnvironmentConfig()
	if err != nil {
		return err
	}
	link, err := autobuild.NewAutoLinkBuildsFromEnvironment()
	switch {
	case err == autobuild.ErrNotEnabled:
	case err != nil:
		log.Fatal(err)
	default:
		link.LinkFn = func(name string) *url.URL { return gitserver.RepositoryURL(config, name, nil) }
		clones, err := link.Link()
		if err != nil {
			log.Printf("error: %v", err)
			break
		}
		for name, v := range clones {
			config.InitialClones[name] = v
		}
	}
	return gitserver.Start(config)
}