Commit 4a3a83cf authored by Jacob Vosmaer's avatar Jacob Vosmaer

Add Makefile

parent 0382528d
gitlab-git-http-server
PREFIX=/usr/local
VERSION=$(shell git describe)-$(shell date -u +%Y%m%d.%H%M%S)
gitlab-git-http-server: main.go
go build -ldflags "-X main.Version ${VERSION}" -o gitlab-git-http-server main.go
...@@ -38,11 +38,13 @@ type gitEnv struct { ...@@ -38,11 +38,13 @@ type gitEnv struct {
GL_ID string GL_ID string
} }
var Version string
var httpClient = &http.Client{} var httpClient = &http.Client{}
var pathTraversal = regexp.MustCompile(`/../`) var pathTraversal = regexp.MustCompile(`/../`)
// Command-line options // Command-line options
var repoRoot string var repoRoot string
var printVersion = flag.Bool("version", false, "Print version and exit")
var listenAddr = flag.String("listenAddr", "localhost:8181", "Listen address for HTTP server") var listenAddr = flag.String("listenAddr", "localhost:8181", "Listen address for HTTP server")
var authBackend = flag.String("authBackend", "http://localhost:8080", "Authentication/authorization backend") var authBackend = flag.String("authBackend", "http://localhost:8080", "Authentication/authorization backend")
...@@ -60,6 +62,10 @@ func main() { ...@@ -60,6 +62,10 @@ func main() {
flag.PrintDefaults() flag.PrintDefaults()
} }
flag.Parse() flag.Parse()
if *printVersion {
fmt.Printf("gitlab-git-http-server %s\n", Version)
os.Exit(0)
}
repoRoot = flag.Arg(0) repoRoot = flag.Arg(0)
if repoRoot == "" { if repoRoot == "" {
flag.Usage() flag.Usage()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment