aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd/git-lfs-server/main.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/cmd/git-lfs-server/main.go b/cmd/git-lfs-server/main.go
index e5fd7d1..dcc24b2 100644
--- a/cmd/git-lfs-server/main.go
+++ b/cmd/git-lfs-server/main.go
@@ -13,8 +13,8 @@ import (
13 "hash" 13 "hash"
14 "io" 14 "io"
15 "mime" 15 "mime"
16 "net"
16 "net/http" 17 "net/http"
17 "net/http/cgi"
18 "net/url" 18 "net/url"
19 "os" 19 "os"
20 "os/exec" 20 "os/exec"
@@ -699,6 +699,10 @@ func main() {
699 secretAccessKeyFile := os.Getenv("S3_SECRET_ACCESS_KEY_FILE") 699 secretAccessKeyFile := os.Getenv("S3_SECRET_ACCESS_KEY_FILE")
700 gitolitePath := os.Getenv("GITOLITE_PATH") 700 gitolitePath := os.Getenv("GITOLITE_PATH")
701 baseURLStr := os.Getenv("BASE_URL") 701 baseURLStr := os.Getenv("BASE_URL")
702 listenHost := os.Getenv("LISTEN_HOST")
703 listenPort := os.Getenv("LISTEN_PORT")
704
705 listenAddr := net.JoinHostPort(listenHost, listenPort)
702 706
703 if gitolitePath == "" { 707 if gitolitePath == "" {
704 gitolitePath = "gitolite" 708 gitolitePath = "gitolite"
@@ -710,6 +714,9 @@ func main() {
710 if privateKeyPath == "" { 714 if privateKeyPath == "" {
711 die("Fatal: expected environment variable GITOLFS3_PRIVATE_KEY_PATH to be set") 715 die("Fatal: expected environment variable GITOLFS3_PRIVATE_KEY_PATH to be set")
712 } 716 }
717 if listenPort == "" {
718 die("Fatal: expected environment variable LISTEN_PORT to be set")
719 }
713 if baseURLStr == "" { 720 if baseURLStr == "" {
714 die("Fatal: expected environment variable BASE_URL to be set") 721 die("Fatal: expected environment variable BASE_URL to be set")
715 } 722 }
@@ -752,7 +759,8 @@ func main() {
752 die("Fatal: failed to create S3 client: %s", err) 759 die("Fatal: failed to create S3 client: %s", err)
753 } 760 }
754 761
755 if err = cgi.Serve(&handler{mc, bucket, anonUser, gitolitePath, privateKey, baseURL}); err != nil { 762 h := &handler{mc, bucket, anonUser, gitolitePath, privateKey, baseURL}
763 if err = http.ListenAndServe(listenAddr, h); err != nil {
756 die("Fatal: failed to serve CGI: %s", err) 764 die("Fatal: failed to serve CGI: %s", err)
757 } 765 }
758} 766}