diff options
Diffstat (limited to 'src/edit/main.go')
-rw-r--r-- | src/edit/main.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/edit/main.go b/src/edit/main.go index a7ec7bd..66e9a36 100644 --- a/src/edit/main.go +++ b/src/edit/main.go @@ -9,6 +9,7 @@ import ( func ServeIndex(out http.ResponseWriter, in *http.Request) { if in.URL.Path != "/" { http.NotFound(out, in) + return } http.Redirect(out, in, "/files/", http.StatusMovedPermanently) } @@ -16,9 +17,9 @@ func ServeIndex(out http.ResponseWriter, in *http.Request) { func main() { socket, err := util.StreamListener(os.Args[1], os.Args[2]) errcheck(err) - errcheck(os.Chdir("/srv/http/edit.team4272.com/www.git")) + errcheck(os.Setenv("GIT_DIR", "/srv/http/edit.team4272.com/www.git")) http.Handle("/", util.SaneHTTPHandler{http.HandlerFunc(ServeIndex)}) - http.Handle("/static/", util.SaneHTTPHandler{http.FileServer(http.Dir("static"))}) + http.Handle("/static/", util.SaneHTTPHandler{http.StripPrefix("/static", http.FileServer(http.Dir("static")))}) http.Handle("/files/", util.SaneHTTPHandler{http.StripPrefix("/files", http.HandlerFunc(ServeGit))}) errcheck(http.Serve(socket, nil)) } |