-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.go
More file actions
29 lines (24 loc) · 809 Bytes
/
main.go
File metadata and controls
29 lines (24 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package main
import (
"flag"
"log"
"net/http"
"os"
)
func main() {
var (
reposDir = flag.String("r", ".", "Directory containing git repositories")
cacheDir = flag.String("c", ".", "Cache dir for storing archives")
tmpDir = flag.String("t", os.TempDir(), "Tmp dir for archive generation")
addr = flag.String("l", ":5000", "Address/port to listen on")
numWorkers = flag.Int("w", 10, "Number of workers")
)
flag.Parse()
jobs, results := ArchiveWorkerPool(*numWorkers, *tmpDir)
jobs, results = ArchiveCache(jobs, results, *cacheDir)
requests := RequestMux(jobs, results)
repositoryStore := &GitRepositoryStore{*reposDir}
archiveGenerator := &ArchiveGenerator{repositoryStore, requests}
server := &Server{archiveGenerator}
log.Fatal(http.ListenAndServe(*addr, server))
}